QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103007#5156. Going in Circlesw4p3rWA 50ms3396kbC++201.4kb2023-05-03 22:05:592023-05-03 22:06:00

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 22:06:00]
  • 评测
  • 测评结果:WA
  • 用时:50ms
  • 内存:3396kb
  • [2023-05-03 22:05:59]
  • 提交

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