QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#269073 | #7517. Flying Ship Story | Terk | WA | 212ms | 3568kb | C++14 | 1.0kb | 2023-11-29 11:49:32 | 2023-11-29 11:49:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int q,n,pre;
struct node{
int x,y,w;
}Rem[10];
int cmp(node a,node b){
return a.w>b.w;
}
int check(int x,int y,int i){
if(i==n+1) return 1;
if(Rem[i].x!=x&&Rem[i].y!=y) return 1;
return 0;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>q;
while(q--){
int op,x,y,w;
cin>>op>>x>>y;
x^=pre;
y^=pre;
if(op==1){
cin>>w;
w^=pre;
Rem[++n]={x,y,w};
sort(Rem+1,Rem+1+n,cmp);
for(int i=1;i<=n;i++){
int cnt1=0,cnt2=0;
for(int j=1;j<i;j++){
if(Rem[i].x==Rem[j].x&&Rem[i].y==Rem[j].y) Rem[i].w=0;
if(Rem[i].x==Rem[j].x) cnt1++;
if(Rem[i].y==Rem[j].y) cnt2++;
}
if(cnt1>1||cnt2>1) Rem[i].w=0;//同行或列出现俩一样的就没用了
}
sort(Rem+1,Rem+1+n,cmp);
n=min(n,4);
}
if(op==2){
for(int i=1;i<=n+1;i++){
if(check(x,y,i)){
pre=Rem[i].w;
cout<<Rem[i].w<<'\n';
break;
}
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3508kb
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: 212ms
memory: 3568kb
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'