QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#765011#7517. Flying Ship Storyucup-team4352#WA 309ms3712kbC++231.3kb2024-11-20 11:36:532024-11-20 11:36:57

Judging History

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

  • [2024-11-20 11:36:57]
  • 评测
  • 测评结果:WA
  • 用时:309ms
  • 内存:3712kb
  • [2024-11-20 11:36:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int q,opt,x,y,w;
struct Data{
	int x,y,w;
}a[10],b[10];
int cnt,tot,last;
map<int,int>mapp1,mapp2;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>q;
	while(q--) {
		cin>>opt>>x>>y;
		x^=last,y^=last;
		if(opt==1) {
			mapp1.clear(),mapp2.clear();
			cin>>w;
			w^=last;
			tot=0;
			int p=1,flag=0;
			while((flag==0||p<=cnt)&&tot<4) {
				if(flag==0&&p<=cnt) {
					if(w>a[p].w) {
						flag=1;
						if(mapp1[x]<2&&mapp2[y]<2) {
							b[++tot]=(Data){x,y,w};
							mapp1[x]++;
							mapp2[y]++;
						}
					}
					else {
						if(mapp1[a[p].x]<2&&mapp2[a[p].y]<2) {
							b[++tot]=a[p];
							mapp1[a[p].x]++;
							mapp2[a[p].y]++;
						}
						p++;
					}
				}
				else if(flag==0) {
					flag=1;
					if(mapp1[x]<2&&mapp2[y]<2) {
						b[++tot]=(Data){x,y,w};
						mapp1[x]++;
						mapp2[y]++;
					}
				}
				else if(p<=cnt) {
					if(mapp1[a[p].x]<2&&mapp2[a[p].y]<2) {
						b[++tot]=a[p];
						mapp1[a[p].x]++;
						mapp2[a[p].y]++;
					}
					p++;
				}
			}
			cnt=tot;
			for(int i=1;i<=tot;++i) a[i]=b[i];
		}
		else {
			int res=0;
			for(int i=1;i<=cnt;++i) if(a[i].x!=x&&a[i].y!=y) {res=a[i].w;break;}
			cout<<res<<'\n';
			last=res;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

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
Wrong Answer
time: 309ms
memory: 3712kb

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:

wrong answer 4th lines differ - expected: '11995570', found: '0'