QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283403 | #7517. Flying Ship Story | light_ink_dots# | WA | 227ms | 1608kb | C++20 | 1.6kb | 2023-12-14 16:19:49 | 2023-12-14 16:19:49 |
Judging History
answer
#include<stdio.h>
using namespace std;
int n,m,T,tot,lastans;
struct node{
int x,y,w;
}mx,smx,r[2],c[2];
void upd(node &res,node now,int x,int y){
if(x!=now.x&&y!=now.y&&now.w>res.w)
res=now;
}
int main(){
scanf("%d",&T);
while(T--){
int o,x,y,w;
scanf("%d%d%d",&o,&x,&y),x^=lastans,y^=lastans;
if(o==1){
scanf("%d",&w),w^=lastans;
node now=node{x,y,w};
if(w>mx.w){
if(x==mx.x&&y==mx.y)
mx=now;
else if(x==mx.x){
node nxts=node{0,0,0};
upd(nxts,smx,-1,y),upd(nxts,r[0],-1,y),upd(nxts,r[1],-1,y),smx=nxts;
node nxt=node{0,0,0};
upd(nxt,c[0],-1,y),upd(nxt,c[1],-1,y),c[1]=nxt,c[0]=mx,mx=now;
}
else if(y==mx.y){
node nxts=node{0,0,0};
upd(nxts,smx,x,-1),upd(nxts,c[0],x,-1),upd(nxts,c[1],x,-1),smx=nxts;
node nxt=node{0,0,0};
upd(nxt,r[0],x,-1),upd(nxt,r[1],x,-1),r[1]=nxt,r[0]=mx,mx=now;
}
else{
node nxtr=node{0,0,0},nxtc=node{0,0,0};
upd(nxtr,r[0],x,-1),upd(nxtr,r[1],x,-1);
upd(nxtc,c[0],-1,y),upd(nxtc,c[1],-1,y);
r[1]=nxtr,c[1]=nxtc,r[0]=c[0]=smx=mx,mx=now;
}
}
else{
upd(smx,now,mx.x,mx.y);
if(x!=mx.x){
if(w>r[0].w){
if(x!=r[0].x)
r[1]=r[0];
r[0]=now;
}
else upd(r[1],now,r[0].x,-1);
}
if(y!=mx.y){
if(w>c[0].w){
if(y!=c[0].y)
c[1]=c[0];
c[0]=now;
}
else upd(c[1],now,-1,c[0].y);
}
}
}
if(o==2){
node res=node{0,0,0};
upd(res,mx,x,y),upd(res,smx,x,y),upd(res,r[0],x,y),upd(res,r[1],x,y),upd(res,c[0],x,y),upd(res,c[1],x,y);
printf("%d\n",lastans=res.w);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1584kb
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: 0
Accepted
time: 201ms
memory: 1484kb
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 11995570 915818845 783627723 915818845 0 0 915818845 0 783627723 0 904468304 904468304 904468304 915818845 904468304 915818845 904468304 915818845 0 904468304 0 915818845 915818845 0 0 915818845 915818845 0 921710773 0 921710773 998138906 921710773 0 921710773 998138906 0 998138906 0 99...
result:
ok 500000 lines
Test #3:
score: -100
Wrong Answer
time: 227ms
memory: 1608kb
input:
1000000 2 648544745 437316088 1 1 1 221075686 2 802693951 691188141 1 221075687 221075684 1036811136 2 771835961 178451319 1 820061031 820061031 560017372 2 829408420 820061028 1 293604539 293604539 699366423 2 293604539 293604539 1 1 2 610044241 2 50747012 885321059 1 942633132 942633132 603537610 ...
output:
0 221075686 820061030 293604538 0 942633133 942633133 27478144 820061030 820061030 900696946 27478144 942633133 942633133 0 772167494 27478144 891145650 900696946 0 942633133 942633133 942633133 942633133 942633133 942633133 942633133 979713065 979713065 979713065 979713065 979713065 979713065 97971...
result:
wrong answer 20th lines differ - expected: '772167494', found: '0'