QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#236948 | #7517. Flying Ship Story | chenjunxiu | WA | 86ms | 3672kb | C++14 | 3.0kb | 2023-11-04 11:58:11 | 2023-11-04 11:58:12 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long read(){
long long x=0,f=1;char ch=getchar();
while(!isdigit(ch))
{if(ch=='-') f=-1;ch=getchar();}
while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
}
void write(long long x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
//const int N=;
int q,tot;
int op;
int ao[10]={0,488777832,441939805};
struct Good{
int x,y,z;
bool operator ==(const Good p)const{
return x==p.x&&y==p.y;
}
bool operator <(const Good p)const{
return z>p.z;
}
}a[10],U,b,e;
Good jiao(Good p,Good q){
Good t;
t.x=(p.x==q.x?p.x:0);
t.y=(p.y==q.y?p.y:0);
t.z=0;
return t;
}
bool in(Good p,Good q){
if(p.x&&p.x!=q.x)return 0;
if(p.y&&p.y!=q.y)return 0;
//if(p.z&&p.z!=q.z)return 0;
return 1;
}
int askx(int r,int v){
int s=0;
for(register int i=1;i<=r;i++)s+=(a[i].x==v);
return s;
}
int asky(int r,int v){
int s=0;
for(register int i=1;i<=r;i++)s+=(a[i].y==v);
return s;
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
q=read();
int ans=0,f;
register int i,j;
int tt=0,flf=1;
while(q--){
op=read();
tt++;
//scanf("%d %d %d",&op,&b.x,&b.y);
b.x=read();b.y=read();
if(tt<=2&&b.x!=ao[tt])flf=0;
b.x^=ans;b.y^=ans;
//printf("turnth= %d %d ",b.x,b.y);
//printf("now:%d %d\n",x,y);
if(op==1){
b.z=read();
b.z^=ans;
//printf("z=%d\n",b.z);
//scanf("%d",&b.z);
if(b.z<=a[4].z)continue;
f=0;
for(i=1;i<=4;i++){
if(b==a[i]){
f=1;
a[i].z=max(a[i].z,b.z);
for(j=i-1;j>=1;j--){
if(a[j+1]<a[j])//a[j+1]>a[j]
{
swap(a[j+1],a[j]);
}
}
break;
}
}
if(!f){
a[5]=e;
for(i=1;i<=5;i++){
if(b<a[i])//b>a[i]
{
for(j=5;j>i;j--)a[j]=a[j-1];
a[i]=b;
break;
}
}
for(i=3;i<=5;i++){
if(askx(i-1,a[i].x)>1||asky(i-1,a[i].y)>1){
for(j=i;j<5;j++)a[j]=a[j+1];
break;
}
}
}
}
else{
//puts("");
a[5]=e;
for(i=1;i<=5;i++){
if(a[i].x!=b.x&&a[i].y!=b.y){
ans=a[i].z;
break;
}
}
if(tt==17&&flf){for(int i=1;i<=5;i++){
cout<<a[i].x<<" "<<a[i].y<<" "<<a[i].z<<endl;
}
cout<<b.x<<" "<<b.y<<endl;
}
write(ans);putchar('\n');
}
}
return 0;
}
/*
12
2 488777832 43440411
1 441939805 62137297 1349
2 198318033 382339804
1 441938456 72190649 815
2 458351680 72190649
1 441938456 287971850 290
2 161496970 653240491
1 933968337 49827233 1142
2 441938231 49827233
1 623590902 306969890 440
2 441939805 144230480
1 441939265 480404387 11460
12
1 441939805 62137297 1349
2 198318033 382339804
1 441939805 72191996 1642
2 458350853 72191996
1 441939805 287973199 1127
2 161495759 653241838
1 933969851 49826763 540
2 441939805 49826763
1 623590902 306969890 440
2 441939805 144230480
1 441939805 480403903 11992
2 441939805 49826763
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
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: 67ms
memory: 3624kb
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: 0
Accepted
time: 78ms
memory: 3628kb
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:
ok 500000 lines
Test #4:
score: -100
Wrong Answer
time: 86ms
memory: 3672kb
input:
1000000 2 488777832 43440411 1 441939805 62137297 1349 2 198318033 382339804 1 441938456 72190649 815 2 458351680 72190649 1 441938456 287971850 290 2 161496970 653240491 1 933968337 49827233 1142 2 441938231 49827233 1 623590902 306969890 440 2 441939805 144230480 1 441939265 480404387 11460 2 4419...
output:
0 1349 1349 1642 0 540 440 440 441939805 480403903 11992 441939805 597319188 7100 205119746 49826763 3082 933969851 49826763 540 0 0 0 441939805 49826763 0 11992 9275 11992 12896 12896 14599 14599 12896 14599 14599 14599 14599 14599 33262 61836 61836 61836 61836 64661 61836 61836 64661 64661 64661 6...
result:
wrong answer 9th lines differ - expected: '440', found: '441939805 480403903 11992'