QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521396#2199. Intriguing Selectionbachbeo2007WA 1ms3644kbC++23809b2024-08-16 10:03:282024-08-16 10:03:29

Judging History

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

  • [2024-08-16 10:03:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3644kb
  • [2024-08-16 10:03:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
bool ask(int x,int y){
    cout << "? " << x << ' ' << y << endl;
    char c;cin >> c;return (c=='<');
}

void solve(){
    int n;cin >> n;
    vector<int> a(2*n);
    iota(a.begin(),a.end(),1);
    function<int(int,int)> get = [&](int l,int r){
        if(l+1==r) return a[l];
        int mid=(l+r)>>1;
        int x=get(l,mid),y=get(mid,r);
        if(x==-1) return y;
        else if(y==-1) return x;
        else return y+ask(x,y)*(x-y);
    };
    for(int i=0;i<n;i++) a[get(0,2*n)]=-1;
    cout << "!" << endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int test;cin >> test;
    while(test--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3644kb

input:

2
3
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
3
>
<
<
>
<
<
<
>
<
<
<
>
<

output:

? 2 3
? 1 3
? 5 6
? 4 6
? 3 6
? 2 3
? 1 3
? 5 6
? 4 6
? 3 6
? 2 3
? 1 3
? 5 6
? 4 6
? 3 6
!
? 2 3
? 1 3
? 5 6
? 4 5
? 1 5
? 1 3
? 5 6
? 4 5
? 1 5
? 1 3
? 5 6
? 4 5
? 1 5
!

result:

wrong answer Case 0: the top n are not uniquely determined: 4 is not compared to 1