QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#564560 | #2199. Intriguing Selection | fzx | WA | 18ms | 5644kb | C++14 | 1.2kb | 2024-09-15 09:57:47 | 2024-09-15 09:57:48 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
mt19937 rnd(114514);
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;
for (int i=2;i<=n*2;i++) swap(p[gen(1,i-1)],p[i]);
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: 5640kb
input:
2 3 > > < < > > > > > 3 > > > > > < > < >
output:
? 2 5 ? 3 6 ? 4 1 ? 6 5 ? 4 6 ? 4 5 ? 3 5 ? 3 4 ? 2 4 ! ? 3 1 ? 6 4 ? 2 5 ? 4 1 ? 5 1 ? 5 4 ? 3 5 ? 3 4 ? 2 3 !
result:
ok 2 cases
Test #2:
score: -100
Wrong Answer
time: 18ms
memory: 5644kb
input:
1111 3 > < > > < > > < > 3 > < < > < > > > > 3 < < < < < < > > > 3 < > > > < > > < > 3 < > > < > > < > 3 < > > > > > > < < 3 < > > > > > > > > 3 > > > > < > > > > 3 < < < > > < > > > 3 < > < < < < < < 3 < < > < > > < > 3 > < < > > > > > > 3 > < < < > > < > 3 < < > < < < > < > 3 > > > > > < > > < 3 <...
output:
? 2 5 ? 3 6 ? 4 1 ? 3 5 ? 1 5 ? 3 5 ? 4 5 ? 4 3 ? 2 4 ! ? 3 1 ? 6 4 ? 2 5 ? 6 1 ? 2 1 ? 6 1 ? 5 1 ? 5 6 ? 3 6 ! ? 6 1 ? 5 3 ? 4 2 ? 5 6 ? 4 5 ? 5 6 ? 2 5 ? 2 6 ? 3 6 ! ? 6 1 ? 3 2 ? 4 5 ? 2 6 ? 5 6 ? 2 6 ? 4 6 ? 4 2 ? 1 4 ! ? 3 1 ? 5 4 ? 6 2 ? 4 3 ? 2 4 ? 2 3 ? 5 3 ? 2 3 ! ? 2 1 ? 5 3 ? 6 4 ? 3 2 ? ...
result:
wrong answer Case 5: all players in topn are comparable