QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#564566#2199. Intriguing SelectionfzxWA 7ms5684kbC++141.2kb2024-09-15 10:00:282024-09-15 10:00:28

Judging History

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

  • [2024-09-15 10:00:28]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:5684kb
  • [2024-09-15 10:00:28]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long 
#define pb push_back
using namespace std;
mt19937 rnd(4);
int gen(int l,int r) {return rnd()%(r-l+1)+l;}
const int INF=5e5+5;
int n,v3[INF],pre[INF],p[INF];
vector <int> cnt;
void solve() {
    cin>>n;cnt.clear();
    for (int i=0;i<=n*2;i++) pre[i]=0;
    for (int i=1;i<=n*2;i++) p[i]=i;
    // 4 1 2 5 3 6
    p[1]=4;p[2]=1;p[3]=2;
    p[4]=5;p[5]=3;p[6]=6;
    for (int i=1;i<=n;i++) {
        int x=p[i],y=p[i+n];
        cout<<"? "<<x<<" "<<y<<endl;
        char c;cin>>c;
        if (c=='<') cnt.pb(x),pre[x]=y;
        else cnt.pb(y),pre[y]=x;
    }
    int T=n;
    while (T--) {
        int len=cnt.size(),x=cnt[0];
        for (int i=1;i<len;i++) {
            cout<<"? "<<cnt[i]<<" "<<x<<endl;
            char c;cin>>c;
            if (c=='<') x=cnt[i];
        }
        vector <int> cnt1;
        for (int i=0;i<len;i++)
            if (cnt[i]==x) ;
            else cnt1.pb(cnt[i]);
        if (!pre[x]) ;
        else cnt1.pb(pre[x]);
        cnt=cnt1;
    }
    cout<<"!"<<endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    int t=0;cin>>t;
    while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5684kb

input:

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

output:

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

result:

ok 2 cases

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 5676kb

input:

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

output:

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

result:

wrong answer Case 0: all players in topn are comparable