QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209335#5156. Going in CirclesJooDdaeWA 8ms3684kbC++201.1kb2023-10-10 14:06:112023-10-10 14:06:11

Judging History

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

  • [2023-10-10 14:06:11]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3684kb
  • [2023-10-10 14:06:11]
  • 提交

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