QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401201 | #5156. Going in Circles | ucup-team1716# | WA | 16ms | 3932kb | C++20 | 1.2kb | 2024-04-28 07:13:11 | 2024-04-28 07:13:19 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int pos = 0, cur = 2, dir = 1, l = 0, r = 0;
map<int, int> a;
int x;
cin >> x;
a[0] = x;
bool cont = true;
while(true)
{
for(int i=0; i<cur; i++)
{
//cout << pos << "\n";
if(dir==1)
{
cout << "? right\n";
cout.flush();
}
else
{
cout << "? left\n";
cout.flush();
}
pos += dir;
l = min(l, pos);
r = max(r, pos);
cin >> x;
if(a.find(pos) == a.end()) a[pos] = x;
else if(a[pos] != x)
{
cont = false;
break;
}
}
if(!cont) break;
cout << "? flip\n";
cout.flush();
cin >> x;
a[pos] = x;
cur = 2 * cur;
dir *= -1;
}
if(dir==1) cout << "! " << pos - l << "\n";
else cout << "! " << r - pos << "\n";
cout.flush();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 16ms
memory: 3932kb
input:
0 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 ...
output:
? right ? right ? flip ? left ? left ? left ? left ? flip ? right ? right ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? flip ? right ? right ? right ? right ? right ? right ? ri...
result:
wrong answer Wrong answer: correct guess, but used too many queries. Queries used: 21395 (5895 too many)