QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#521424 | #2199. Intriguing Selection | bachbeo2007 | WA | 0ms | 3804kb | C++23 | 1.1kb | 2024-08-16 10:24:47 | 2024-08-16 10:24:47 |
Judging History
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 solve3(){
int a=2-ask(1,2),b=4-ask(3,4),c=6-ask(5,6);
int na=3^a,nb=7^b,nc=3^c;
int x=a+(b-a)*ask(a,b);
x+=(c-x)*ask(x,c);
int k=x;
if(k!=a) x+=(na-x)*ask(na,x);
if(k!=b) x+=(nb-x)*ask(nb,x);
if(k!=c) x+=(nc-x)*ask(nc,x);
cout << "!" << endl;
}
void solve(){
int n;cin >> n;
if(n==3){
solve3();
return;
}
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: 0
Wrong Answer
time: 0ms
memory: 3804kb
input:
2 3 > > > > > < < 3 < < < < > > >
output:
? 1 2 ? 3 4 ? 5 6 ? 2 4 ? 2 6 ? 3 2 ? 5 3 ! ? 1 2 ? 3 4 ? 5 6 ? 1 3 ? 3 5 ? 2 3 ? 6 3 !
result:
wrong answer Case 0: all players in topn are comparable