QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#360056 | #5156. Going in Circles | kevinyang# | WA | 39ms | 6448kb | C++17 | 1.8kb | 2024-03-21 10:52:43 | 2024-03-21 10:52:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int mxn = 200005;
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
vector<int>arr(mxn);
vector<int>op(mxn);
cin >> arr[0];
for(int i = 1; i<=250; i++){
cout << "? right" << endl;
int v;
cin >> v;
arr[i] = v;
if(rng()%2){
cout << "? flip" << endl;
op[i] = 1;
int x;
cin >> x;
}
}
for(int n = 3; n<=100; n++){
bool good = true;
vector<int>dp(500);
for(int i = 1; i<=n; i++){
dp[i] = arr[i];
}
for(int i = n+1; i<=250; i++){
dp[i] = dp[i-n]^op[i];
if(dp[i] != arr[i]){
good = false;
break;
}
}
if(good){
cout << "! " << n << endl;
return 0;
}
}
int cur = 251;
for(int i = 101; i<=5000; i++){
cout << "? right" << endl;
cin >> arr[cur];
if(rng()%2){
cout << "? flip" << endl;
op[cur] = 1;
int x;
cin >> x;
}
cur++;
cout << "? right" << endl;
cin >> arr[cur];
if(rng()%2){
cout << "? flip" << endl;
op[cur] = 1;
int x;
cin >> x;
}
cur++;
bool good = true;
for(int j = 1; j<=i; j++){
if(arr[j+i] != (arr[j]^op[j])){
good = false;
}
}
if(good){
cout << "! " << i << endl;
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 5ms
memory: 6292kb
input:
0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 ...
output:
? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? right ? right ? right ? flip ? right ? right ? right ? right ? right ? right ? flip ? right ? right ? flip ? right...
result:
ok Queries used; 15098.
Test #2:
score: 0
Accepted
time: 23ms
memory: 6288kb
input:
1 0 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 ...
output:
? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ...
result:
ok Queries used; 14560.
Test #3:
score: 0
Accepted
time: 24ms
memory: 6448kb
input:
0 0 1 1 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 0 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 0 ...
output:
? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? r...
result:
ok Queries used; 15141.
Test #4:
score: 0
Accepted
time: 39ms
memory: 6164kb
input:
0 0 1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 1 1 0 1 0 1 0 1 ...
output:
? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? right ? right ? right...
result:
ok Queries used; 12329.
Test #5:
score: 0
Accepted
time: 9ms
memory: 6428kb
input:
0 0 1 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 ...
output:
? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? right ? flip ? right ?...
result:
ok Queries used; 12348.
Test #6:
score: 0
Accepted
time: 15ms
memory: 6420kb
input:
0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 0 0 ...
output:
? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? right ? right ? right ? flip ?...
result:
ok Queries used; 12374.
Test #7:
score: 0
Accepted
time: 30ms
memory: 6296kb
input:
0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 ...
output:
? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? right ? ...
result:
ok Queries used; 15132.
Test #8:
score: 0
Accepted
time: 16ms
memory: 6316kb
input:
0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 ...
output:
? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? ...
result:
ok Queries used; 14671.
Test #9:
score: 0
Accepted
time: 20ms
memory: 6300kb
input:
0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 ...
output:
? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ?...
result:
ok Queries used; 15140.
Test #10:
score: 0
Accepted
time: 21ms
memory: 6292kb
input:
0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 ...
output:
? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? right ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ...
result:
ok Queries used; 12371.
Test #11:
score: 0
Accepted
time: 27ms
memory: 6380kb
input:
0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 ...
output:
? right ? right ? flip ? right ? right ? right ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? right ? right ? right ? right ? right ? flip ? rig...
result:
ok Queries used; 12258.
Test #12:
score: 0
Accepted
time: 28ms
memory: 6348kb
input:
0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 ...
output:
? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? ...
result:
ok Queries used; 12364.
Test #13:
score: -100
Wrong Answer
time: 12ms
memory: 6192kb
input:
0 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 0 1 1 1 ...
output:
? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? f...
result:
wrong answer Wrong answer: used too many queries. Queries used: 1246 (599 too many, terminated)