QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103007 | #5156. Going in Circles | w4p3r | WA | 50ms | 3396kb | C++20 | 1.4kb | 2023-05-03 22:05:59 | 2023-05-03 22:06:00 |
Judging History
answer
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e - 6
#define FOR(i, a, b) for(int i = a;i <= b;i ++)
#define REP(i, a, b) for(int i = a;i >= b;i --)
#define pa pair<int, int>
#define fr first
#define sd second
#define pb push_back
#define db double
#define MEM(a) memset(a, 0, sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read()
{
char ch = getchar();
ll s = 0, w = 1;
while (ch < '0' || ch > '9') {if (ch == '-')w = -1; ch = getchar();}
while (ch >= '0' && ch <= '9') {s = s * 10 + ch - '0'; ch = getchar();}
return s * w;
}
int n;
inline void qry(string a, int &x)
{
cout << "? " << a << endl;
cin >> x;
}
int main()
{
int t;
cin >> t;
FOR(len, 3, 20)
{
int cur = t;
int tmp = len;
while (tmp --) qry("right", t);
if (t != cur) continue; tmp = len;
qry ("flip", t);
while (tmp --) qry("left", t);
if (t == cur) continue;
cout << "!" << len << endl;
return 0;
}
mt19937 rnd(time(0));
int c[21];
FOR(i, 1, 20) c[i] = rnd() % 2;
FOR(i, 1, 20)
{
if(t != c[i]) qry("flip", t);
qry("right", t);
}
deque<int> now; now.push_back(t);int s = 1;
while(true)
{
qry("right", t); s++; now.push_back(t);
if(now.size() < 20) continue;
if(now.size() > 20) now.pop_front();
int fl = 0;
FOR(i, 1, 20)if (c[i] != now[i-1]) fl = 1;
if (!fl) {cout<< "! " << n <<endl; return 0;}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 50ms
memory: 3396kb
input:
0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 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 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 0 ...
output:
? right ? right ? right ? flip ? left ? left ? left ? right ? right ? right ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? left ? right ? right ? right ? right ? rig...
result:
wrong answer Wrong answer: incorrect guess 0 (ans: 5000). Queries used: 5334