QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#407390 | #8267. Staring Contest | Physics212303 | Compile Error | / | / | C++17 | 706b | 2024-05-08 17:14:33 | 2024-05-08 17:14:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int n; cin>>n;
vector<int> p(n);
iota(p.begin(),p.end(),0);
shuffle(p.begin(),p.end(),mt19937(random_device()()));
auto ask=[&](int x,int y){
cout<<"? "<<x<<' '<<y<<endl;
int r; cin>>r; return r;
};
int x=-1,y=-1,w=-1;
for(int i:p){
if(x<0)x=i;
else if(y<0)y=i,w=ask(x,y);
else{
int o=ask(x,i),t;
if(w<o)a[y]=w,y=i,w=o;
else if(w>o)a[i]=o;
else if((t=ask(y,i))==w)a[i]=a[x]=a[y]=w,x=y=-1;
else a[x]=w,x=y,y=i,w=t;
}
}
if(~x)a[x]; if(~y)a[y]=w;
cout<<"! ";
for(int i:a)cout<<i+1<<' ';
cout<<endl;
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:19:14: error: ‘a’ was not declared in this scope 19 | if(w<o)a[y]=w,y=i,w=o; | ^ answer.code:20:19: error: ‘a’ was not declared in this scope 20 | else if(w>o)a[i]=o; | ^ answer.code:21:31: error: ‘a’ was not declared in this scope 21 | else if((t=ask(y,i))==w)a[i]=a[x]=a[y]=w,x=y=-1; | ^ answer.code:22:12: error: ‘a’ was not declared in this scope 22 | else a[x]=w,x=y,y=i,w=t; | ^ answer.code:25:9: error: ‘a’ was not declared in this scope 25 | if(~x)a[x]; if(~y)a[y]=w; | ^ answer.code:25:21: error: ‘a’ was not declared in this scope 25 | if(~x)a[x]; if(~y)a[y]=w; | ^ answer.code:27:13: error: ‘a’ was not declared in this scope 27 | for(int i:a)cout<<i+1<<' '; | ^