QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#66562#5156. Going in Circleskaruna#RE 0ms0kbC++171.1kb2022-12-08 22:05:442022-12-08 22:05:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-08 22:05:47]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2022-12-08 22:05:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

mt19937 rnd(15'571'557);
int rd() {
    return uniform_int_distribution<int>(0, 1)(rnd);
}
int ans[5050], fail[101010];
vector<int> A, B;

int str[5050], pt = 0, t = 5000;
int main() {
    int s; cin >> s;
    int cnt = 0, p = 0, q = 0, limit = 490;
    while (cnt < limit) {
        int f = rd();
        if (f) {
            A.push_back(s);
            B.push_back(s);
        }
        else {
            A.push_back(s);
            B.push_back(!s);
            cout << "? flip" << endl;
            cin >> s;
        }
        int n = A.size();

        if (n >= 2) {
            while (p && B[n - 1] != B[p]) p = fail[p - 1];
            if (B[n - 1] == B[p]) fail[n - 1] = ++p;

            while (q && B[q] != A[n - 1]) q = fail[q - 1];
            if (B[q] == A[n - 1]) ++q;
        }
        
        if (A.size() >= 100 && A.size() % 2 == 0) {
            int x = n - q;
            limit = 490 + 3 * x;
        }
        cout << "? right" << endl;
        cin >> s;
    }
    cout << "! " << (limit - 490) / 3 << endl;
}

详细

Test #1:

score: 0
Runtime Error

input:

0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
0
1
0
0
0
1
0
1
1
1
0
0
1
0
1
0
0
1
1
0
1
0
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
1
1
0
1
0
0
1
0
1
0
1
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
...

output:

? flip
? right
? flip
? right
? right
? right
? flip
? right
? flip
? right
? flip
? right
? flip
? right
? flip
? right
? right
? flip
? right
? right
? right
? right
? flip
? right
? flip
? right
? flip
? right
? right
? right
? flip
? right
? right
? flip
? right
? flip
? right
? flip
? right
? r...

result: