QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#564575#2199. Intriguing SelectionfzxWA 41ms7720kbC++141.4kb2024-09-15 10:16:362024-09-15 10:16:37

Judging History

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

  • [2024-09-15 10:16:37]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:7720kb
  • [2024-09-15 10:16:36]
  • 提交

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;
const int INFN=1e3+5;
int n,v3[INF],pre[INF],p[INF];
vector <int> cnt;
map <int,map<int,int> >Map;
char cc[INFN][INFN];
char query(int x,int y) {
    if (Map[x][y]) return cc[x][y];
    char c;cout<<"? "<<x<<" "<<y<<endl;
    cin>>c;cc[x][y]=c;Map[x][y]=1;return c;
}
void solve() {
    cin>>n;cnt.clear();Map.clear();
    for (int i=0;i<=n*2;i++) pre[i]=0;
    for (int i=1;i<=n*2;i++) p[i]=i;
    for (int i=1;i<=n;i++) {
        int x=p[i],y=p[i+n];
        char c=query(x,y);
        if (c=='<') cnt.pb(x),pre[x]=y;
        else cnt.pb(y),pre[y]=x;
    }
    sort(cnt.begin(),cnt.end(),[](int x,int y){return query(x,y)=='<';});
    int T=n;
    while (T--) {
        int len=cnt.size(),x=cnt[0];
        for (int i=1;i<len;i++) {
            char c=query(cnt[i],x);
            if (c=='<') x=cnt[i];
        }
        if (T) sort(cnt.begin(),cnt.end(),[](int x,int y){return query(x,y)=='<';});
        vector <int> cnt1;
        if (!pre[x]) ;
        else cnt1.pb(pre[x]);
        for (int i=0;i<len;i++)
            if (cnt[i]==x) ;
            else cnt1.pb(cnt[i]);
        cnt=cnt1;
    }
    cout<<"!"<<endl;
}
signed main()
{
    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: 0ms
memory: 7720kb

input:

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

output:

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

result:

ok 2 cases

Test #2:

score: -100
Wrong Answer
time: 41ms
memory: 5616kb

input:

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

output:

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

result:

wrong answer Case 6: all players in topn are comparable