QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140803#5156. Going in CirclesAnwar_Gehad_Maghraby#WA 2ms3388kbC++231.6kb2023-08-16 20:37:542023-08-16 20:37:57

Judging History

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

  • [2023-08-16 20:37:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3388kb
  • [2023-08-16 20:37:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

vector<int> wrt, readd;
int get(){
    int r1= rand() & 1;
    int r2= rand() & 1;
    int r3= rand() & 1;
    return (r1 + r2 + r3) & 1;
}
int Flip(){
    cout<<"? flip\n"; cout.flush();
    int x; cin>>x;
    return x;
}
int Right(){
    cout<<"? right\n"; cout.flush();
    int x; cin>>x;
    return x;
}

void out(int n){
    cout<<"! "<<n; cout.flush();
    exit(0);
}

int p;
void check(){
    int sz = readd.size();
    int szwrite= wrt.size();
    while(sz >= 2 * p)
    {
        bool valid = 1;
        for(int j = 0, k = p; k < sz && j < szwrite; k++, j++){
            if(readd[k] != wrt[j]){
                valid= 0;
                break;
            }
        }
        if(valid)
        {
            out(p);
        }
        p++;
    }
}
int main() {
    cin.tie(0);cin.sync_with_stdio(0);
    cout.tie(0);cout.sync_with_stdio(0);

    int cur;
    cin>>cur;

    int qs = 500;
    while(qs > 1)
    {
        readd.push_back(cur);
        int put= get();
        if(put != cur){
            int u = Flip();
            if(u != put) exit(0);
            qs--;
        }
        wrt.push_back(put);
        cur= Right();
        qs--;
    }
    p= 3;
    check();
    int ops = 3 * 5000 + 10;
    while(ops > 1)
    {
        readd.push_back(cur);
        int put= get();
        if(put != cur){
            if(put != cur) exit(0);
            ops--;
        }
        wrt.push_back(put);
        cur= Right();
        check();
        ops--;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3388kb

input:

0
1
0
1
0
1
0
0
1
0
1
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
0
0
0
0
1
1
1
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
1
0
1
1
0
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
1
0
1
0
1
0
1
0
0
1
0
0
1
0
0
1
0
1
0
0
1
1
0
1
0
0
1
1
...

output:

? right
? right
? flip
? right
? right
? flip
? right
? right
? right
? right
? flip
? right
? right
? right
? flip
? right
? flip
? right
? right
? right
? right
? right
? right
? right
? right
? flip
? right
? flip
? right
? flip
? right
? flip
? right
? flip
? right
? right
? right
? flip
? right...

result:

wrong answer format  Unexpected end of file - token expected