QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#66562 | #5156. Going in Circles | karuna# | RE | 0ms | 0kb | C++17 | 1.1kb | 2022-12-08 22:05:44 | 2022-12-08 22:05:47 |
Judging History
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...