QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#124823#5156. Going in Circlesjzh#WA 4ms3452kbC++141.7kb2023-07-15 16:16:132023-07-15 16:16:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-15 16:16:14]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3452kb
  • [2023-07-15 16:16:13]
  • 提交

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);
        }
    }
    

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 3452kb

input:

0

output:

right

result:

wrong answer Wrong answer: invalid response type. Queries used: 0