QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#521396 | #2199. Intriguing Selection | bachbeo2007 | WA | 1ms | 3644kb | C++23 | 809b | 2024-08-16 10:03:28 | 2024-08-16 10:03:29 |
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 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;
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: 1ms
memory: 3644kb
input:
2 3 > > > > > > > > > > > > > > > 3 > < < > < < < > < < < > <
output:
? 2 3 ? 1 3 ? 5 6 ? 4 6 ? 3 6 ? 2 3 ? 1 3 ? 5 6 ? 4 6 ? 3 6 ? 2 3 ? 1 3 ? 5 6 ? 4 6 ? 3 6 ! ? 2 3 ? 1 3 ? 5 6 ? 4 5 ? 1 5 ? 1 3 ? 5 6 ? 4 5 ? 1 5 ? 1 3 ? 5 6 ? 4 5 ? 1 5 !
result:
wrong answer Case 0: the top n are not uniquely determined: 4 is not compared to 1