QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#209335 | #5156. Going in Circles | JooDdae | WA | 8ms | 3684kb | C++20 | 1.1kb | 2023-10-10 14:06:11 | 2023-10-10 14:06:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 50;
int main() {
cin.tie(0)->sync_with_stdio(0);
string s; cin >> s;
for(int i=1;i<=N;i++) {
cout << "? right" << endl;
char c; cin >> c;
s += c;
}
cout << "? flip" << endl;
char c; cin >> c;
s.pop_back();
for(int i=1;i<=N;i++) {
cout << "? left" << endl;
char c; cin >> c;
if(s.back() != c) return cout << "! " << i << endl, 0;
s.pop_back();
}
srand(time(NULL));
for(int i=0;i<N;i++) s.push_back('0'+rand()%2);
for(int i=0;i<N;i++) {
cout << "? right" << endl;
char c; cin >> c;
if(s[i] != c) {
cout << "? flip" << endl;
char c; cin >> c;
}
}
string t;
for(int i=N;;i++) {
cout << "? right" << endl;
char c; cin >> c;
t += c;
if(t.size() == s.size()) {
if(t == s) return cout << "! " << i-N << endl, 0;
t.erase(t.begin());
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 8ms
memory: 3684kb
input:
0 1 0 0 1 0 1 0 1 1 1 1 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 1 0 1 0 1 1 0 1 0 1 0 1 1 0 0 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 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 1 0 1 0 ...
output:
? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? ri...
result:
wrong answer Wrong answer: incorrect guess 4999 (ans: 5000). Queries used: 5175