QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#287371 | #7517. Flying Ship Story | ship2077 | WA | 90ms | 3864kb | C++14 | 1.2kb | 2023-12-20 13:59:40 | 2023-12-20 13:59:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int T,x,y,op,lastans,buc[4];
vector<array<int,3>>vec;
int read(){
int 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 insert(int x,int y,int c){int pos=0;
for (int i=0;i<vec.size();i++)
if (vec[i][2]<c) pos=i;
vec.insert(vec.begin()+pos,{x,y,c});
for (int i=0;i<vec.size();i++)
if (i!=pos&&vec[i][0]==x&&vec[i][1]==y)
return vec.erase(vec.begin()+i),void();
for (int i=0;i<vec.size();i++)
for (int j=i+1;j<vec.size();j++)
for (int k=j+1;k<vec.size();k++)
if (vec[i][0]==vec[j][0]&&vec[j][0]==vec[k][0]||
vec[i][1]==vec[j][1]&&vec[j][1]==vec[k][1]||
vec[i][0]!=vec[j][0]&&vec[i][1]!=vec[j][1]&&
vec[j][0]!=vec[k][0]&&vec[j][1]!=vec[k][1])
return vec.erase(vec.begin()+k),void();
}
int query(int x,int y){
for (int i=0;i<vec.size();i++)
if (vec[i][0]!=x&&vec[i][1]!=y)
return vec[i][2];
return 0;
}
int main(){
T=read();while (T--){
op=read();x=read()^lastans;y=read()^lastans;
if (op==1) insert(x,y,read()^lastans);
if (op==2) printf("%d\n",lastans=query(x,y));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3864kb
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: 90ms
memory: 3560kb
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 716821068 29507197 668870864 668870864 668870864 224107575 224107575 527370820 527370820 527370820 267615457 267615457 401063381 401063381 233649704 233649704 233649704 233649704 482641904 482641904 304847667 304847667 304847667 53908080 53908080 53908080 53908080 537334407 537...
result:
wrong answer 5th lines differ - expected: '915818845', found: '716821068'