QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#269342#7517. Flying Ship Storylsj2009RE 1ms3948kbC++141.3kb2023-11-29 15:30:582023-11-29 15:30:58

Judging History

你现在查看的是最新测评结果

  • [2023-11-29 15:30:58]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3948kb
  • [2023-11-29 15:30:58]
  • 提交

answer

#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define PII pair<int,int>
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define chkmax(a,b) a=max(a,b)
#define chkmin(a,b) a=min(a,b)
#define rep(k,l,r) for(int k=l;k<=r;++k)
#define per(k,r,l) for(int k=r;k>=l;--k)
#define cl(f,x) memset(f,x,sizeof(f))
using namespace std;
void file_IO() {
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
const int N=10;
struct node {
	int x,y,val;
}; node t[N];
int n;
void update() {
	sort(t+1,t+n+1,[](const node &a,const node &b) {
		return a.val>b.val;	
	});
	int cnt=0;
	rep(i,1,n) {
		int c1=0,c2=0;
		rep(j,1,cnt) {
			if(t[i].x==t[j].x)
				++c1;
			if(t[i].y==t[j].y)
				++c2;
		}
		if(c1<=1&&c2<=1)
			t[++cnt]=t[i];
	}
	n=cnt;
}
void solve() {
	int q;
	scanf("%d",&q);
	int last=0;
	while(q--) {
		int op,x,y;
		scanf("%d%d%d",&op,&x,&y);
		x^=last; y^=last;
		if(op==1) {
			int val;
			scanf("%d",&val);
			val^=last;
			t[++n]={x,y,val};
			update();
		} else {
			int res=0;
			rep(i,1,n) {
				if(t[i].x!=x&&t[i].y!=y)
					chkmax(res,t[i].val);
			}
			printf("%d\n",last=res);
		}
	}
}
signed main() {
	//file_IO();
	int testcase=1;
	//scanf("%d",&testcase);
	while(testcase--)
		solve();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3948kb

input:

5
1 2 3 1
1 4 5 2
2 2 2
2 3 7
2 3 4

output:

2
1
0

result:

ok 3 lines

Test #2:

score: -100
Runtime Error

input:

1000000
2 370943499 431961772
1 1 1 11995570
2 37566858 838793045
1 11995571 11995569 908148975
2 11995571 11995571
1 1 3 716821068
2 67877937 3
1 11995571 11995571 771898489
2 38381714 99749723
1 915818844 915818847 729541681
2 592361351 915818846
1 783627722 783627722 639375021
2 102203700 8636489...

output:

0
11995570
0
0
915818845
771898489
915818845
771898489
915818845
915818845
771898489
915818845
915818845
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
968045991
968045991
968045991
968045991
968045991
968045991
968045991
968045991
96804...

result: