QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401201#5156. Going in Circlesucup-team1716#WA 16ms3932kbC++201.2kb2024-04-28 07:13:112024-04-28 07:13:19

Judging History

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

  • [2024-04-28 07:13:19]
  • 评测
  • 测评结果:WA
  • 用时:16ms
  • 内存:3932kb
  • [2024-04-28 07:13:11]
  • 提交

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)