QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208384#5156. Going in CirclesAeren#WA 34ms4080kbC++201.0kb2023-10-09 15:32:382023-10-09 15:32:38

Judging History

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

  • [2023-10-09 15:32:38]
  • 评测
  • 测评结果:WA
  • 用时:34ms
  • 内存:4080kb
  • [2023-10-09 15:32:38]
  • 提交

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)