QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297280 | #6303. Inversion | HJR | WA | 0ms | 35280kb | C++23 | 1.2kb | 2024-01-04 09:17:33 | 2024-01-04 09:17:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cout<<#x<<": "<<x<<endl
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll=long long;
using ull=unsigned long long;
#define int long long
vector<vector<int>> a(2010,vector<int>(2010));
struct node
{
int val,id;
bool operator<(const node&t)const{
if(id<t.id){
return !(a[id][t.id]-a[id+1][t.id]-a[id][t.id-1]+a[id+1][t.id-1]);
}
else{
return a[t.id][id]-a[t.id+1][id]-a[t.id][id-1]+a[t.id+1][id-1];
}
}
};
void solve(){
int n;
cin>>n;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
cout<<"? "<<i+1<<" "<<j+1<<endl;
cout.flush();
cin>>a[i][j];
}
}
vector<node> res(n);
for(int i=0;i<n;i++){
res[i].val=i+1;
res[i].id=i;
}
sort(res.begin(),res.end());
cout<<"! ";
cout.flush();
for(int i=0;i<n;i++){
cout<<res[i].val<<" ";
cout.flush();
}
cout<<endl;
cout.flush();
}
signed main(){
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int t=1;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 35280kb
input:
3 0 0 1
output:
? 1 2 ? 1 3 ? 2 3 ! 3 1 2
result:
wrong answer Wa.