QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#124843 | #5156. Going in Circles | jzh# | WA | 20ms | 3408kb | C++14 | 1.7kb | 2023-07-15 16:27:15 | 2023-07-15 16:27:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const int N = 2e5 + 5;
int rd() {
int u;
cin >> u;
return u;
}
int filp() {
cout << "? filp" << endl;
return rd();
}
int lf() {
cout << "? left" << endl;
return rd();
}
int rt() {
cout << "? right" << endl;
return rd();
}
void answer(int ans) {
cout << "! " << ans << endl;
exit(0);
}
void makeTryEL(int n) {
int new_cur = rt();
if (new_cur == 1) {
filp();
return;
} else if (new_cur == 0) {
filp();
int lst = 0;
for (int i = 0; i < n - 1; i++) {
lst = lf();
}
if (lst == 1) {
answer(n - 1);
}
for (int i = 0; i < n - 1; i++) {
rt();
}
filp();
}
}
deque<int> hashvec = {1, 0, 0, 1, 1,
1, 0, 1, 0, 1,
1, 1, 1, 1, 0,
0, 1, 0, 0, 1};
int main() {
ios::sync_with_stdio(false);
int st = rd();
if (st == 1) {
filp();
}
for (int i = 2; i <= 3; i++) {
int cur = rt();
if (cur == 1) {
filp();
}
}
const int len = 16;
for (int i = 4; i <= len; i++) {
makeTryEL(i);
}
int step_cnt = 0;
deque<int> record;
for (int i = 0; i < len; i++) {
int ret = rt();
if (ret != hashvec[i]) {
filp();
}
}
while (step_cnt < 15500) {
int cur = rt();
step_cnt++;
record.push_back(cur);
while (record.size() > len) record.pop_front();
if (record == hashvec) {
answer(step_cnt);
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 20ms
memory: 3408kb
input:
0 1
output:
? right ? filp
result:
wrong answer Wrong answer: invalid query type. Queries used: 2