QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521404#2199. Intriguing Selectionbachbeo2007WA 20ms3676kbC++23811b2024-08-16 10:08:372024-08-16 10:08:38

Judging History

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

  • [2024-08-16 10:08:38]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:3676kb
  • [2024-08-16 10:08:37]
  • 提交

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]=-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: 100
Accepted
time: 0ms
memory: 3676kb

input:

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

output:

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

result:

ok 2 cases

Test #2:

score: -100
Wrong Answer
time: 20ms
memory: 3556kb

input:

1111
3
>
<
<
>
<
>
<
>
>
>
<
>
3
<
>
>
>
<
<
>
>
<
>
>
>
3
>
>
<
<
>
>
>
<
>
>
>
>
3
<
>
<
>
>
<
>
>
>
<
>
>
3
>
>
<
<
>
>
>
<
>
>
>
<
3
<
>
<
>
<
>
<
>
<
<
>
>
3
>
<
>
>
>
>
<
<
<
>
<
>
3
<
<
>
<
>
<
<
>
<
<
>
>
3
>
>
>
>
>
>
>
<
>
>
>
<
3
<
>
>
<
<
<
>
<
<
>
<
>
3
<
>
>
>
>
<
>
<
<
<
<
>
3
<
>
<
>...

output:

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

result:

wrong answer Case 28: all players in topn are comparable