QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#140803 | #5156. Going in Circles | Anwar_Gehad_Maghraby# | WA | 2ms | 3388kb | C++23 | 1.6kb | 2023-08-16 20:37:54 | 2023-08-16 20:37:57 |
Judging History
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