QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#391771 | #6303. Inversion | Core_65536 | WA | 0ms | 3544kb | C++14 | 788b | 2024-04-16 19:27:39 | 2024-04-16 19:27:39 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
bool cmp(int l,int r){
int a,b,c,d;
cout<<"? "<<l<<" "<<r<<endl; fflush(stdout);
cin>>a;
cout<<"? "<<l+1<<" "<<r<<endl; fflush(stdout);
cin>>b;
cout<<"? "<<l<<" "<<r-1<<endl; fflush(stdout);
cin>>c;
cout<<"? "<<l+1<<" "<<r-1<<endl; fflush(stdout);
cin>>d;
return (a-b-c+d)!=0;
}
void solve(){
int n; cin>>n;
vector<int> ans(n);
for(int i=0;i<n;i++){
ans[i]=i+1;
}
sort(ans.begin(),ans.end(),cmp);
cout<<"! ";
for(int i=0;i<n;i++){
cout<<ans[i]<<" ";
}
}
signed main(){
ios::sync_with_stdio(0);
int T=1; //cin>>T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
input:
3
output:
? 2 1
result:
wrong output format Unexpected end of file - int32 expected