QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#208384 | #5156. Going in Circles | Aeren# | WA | 34ms | 4080kb | C++20 | 1.0kb | 2023-10-09 15:32:38 | 2023-10-09 15:32:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int x = 0, k = -1;
map<int, int> m;
int Right(int n)
{
cout << "? right" << endl;
int ret; cin >> ret;
x++;
if (m.find(x) == m.end()) m[x] = ret;
else if (m[x] != ret) { cout << "! " << n << endl; exit(0); }
return ret;
}
int Left(int n)
{
cout << "? left" << endl;
int ret; cin >> ret;
x--;
if (m.find(x) == m.end()) m[x] = ret;
else if (m[x] != ret) { cout << "! " << n << endl; exit(0); }
return ret;
}
void Flip()
{
cout << "? flip" << endl;
int ret; cin >> ret;
m[x] = ret;
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
int y; cin >> y; m[x] = y;
while(1)
{
if (k == -1)
{
Right(0); Flip(); Left(1);
}
else
{
int len = 1<<k;
if (k % 2 == 0)
{
for(int i=1; i<=len; i++) Left(0);
Flip();
for(int i=1; i<=len*2; i++) Right(i);
}
else
{
for(int i=1; i<=len; i++) Right(0);
Flip();
for(int i=1; i<=len*2; i++) Left(i);
}
}
k++;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 34ms
memory: 4080kb
input:
0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 ...
output:
? right ? flip ? left ? left ? flip ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? left ? left ? left ? flip ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left...
result:
wrong answer Wrong answer: correct guess, but used too many queries. Queries used: 21397 (5897 too many)