QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#391771#6303. InversionCore_65536WA 0ms3544kbC++14788b2024-04-16 19:27:392024-04-16 19:27:39

Judging History

你现在查看的是最新测评结果

  • [2024-04-16 19:27:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3544kb
  • [2024-04-16 19:27:39]
  • 提交

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;
}

詳細信息

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