QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#238229 | #7517. Flying Ship Story | fzj2007 | WA | 82ms | 3676kb | C++17 | 2.0kb | 2023-11-04 16:09:04 | 2023-11-04 16:09:04 |
Judging History
answer
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template<typename T>inline void read(T &x){
x=0;
char ch=getchar();
bool flag=0;
while(ch>'9'||ch<'0') flag=flag||ch=='-',ch=getchar();
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
x=flag?-x:x;
}
template<typename T,typename ...Args>inline void read(T &x,Args &...args){
read(x),read(args...);
}
template<typename T>inline void prt(T x){
if(x>9) prt(x/10);
putchar(x%10+'0');
}
template<typename T>inline void put(T x){
if(x<0) putchar('-'),x=-x;
prt(x);
}
template<typename T>inline void put(char ch,T x){
put(x),putchar(ch);
}
template<typename T,typename ...Args>inline void put(char ch,T x,Args ...args){
put(ch,x),put(ch,args...);
}
#define N 15
int q,n;
struct node{
int x,y,w;
inline bool operator<(const node &b)const{
return w>b.w;
}
}t[N],p[N];
inline void modify(){
sort(t+1,t+n+1);
int state=0,x=0,y=0,u=0,v=0,m=0;
for(int i=1;i<=n;i++){
if(!state) state=1,x=t[i].x,y=t[i].y,p[++m]=t[i];
else if(state==1){
if(t[i].x==x&&t[i].y==y) continue;
if(t[i].x==x) state=2;
else if(t[i].y==y) state=3;
else state=4,u=t[i].x,v=t[i].y;
p[++m]=t[i];
}else if(state==2){
if(t[i].x!=x) state=5,y=t[i].y,p[++m]=t[i];
}else if(state==3){
if(t[i].y!=y) state=5,x=t[i].x,p[++m]=t[i];
}else if(state==4){
int a=t[i].x!=x&&t[i].y!=y,b=t[i].x!=u&&t[i].y!=v;
if(!a&&!b) continue;
if(a&&b) state=6;
else if(a) state=5,x=u,y=v;
else if(b) state=5;
p[++m]=t[i];
}else if(state==5){
if(t[i].x!=x&&t[i].y!=y) p[++m]=t[i],state=6;
}
}
n=m;
for(int i=1;i<=n;i++) t[i]=p[i];
}
int main(){
read(q);
for(int T=1,x,y,w,op,ans=0;T<=q;T++){
read(op,x,y),x^=ans,y^=ans;
if(op==1){
read(w),w^=ans;
t[++n]=(node){x,y,w};
modify();
}else{
ans=0;
for(int i=1;i<=n;i++){
if(t[i].x!=x&&t[i].y!=y){
ans=t[i].w;
break;
}
}
put('\n',ans);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
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: 62ms
memory: 3676kb
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: 82ms
memory: 3608kb
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 772167494 891145650 918281274 772167494 772167494 772167494 772167494 772167494 942633133 918281274 891145650 918281274 891145650 8911456...
result:
wrong answer 168th lines differ - expected: '912214041', found: '0'