QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201630 | #5156. Going in Circles | whsyhyyh# | WA | 0ms | 3628kb | C++14 | 1.5kb | 2023-10-05 15:39:40 | 2023-10-05 15:39:41 |
Judging History
answer
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define N 20010
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define drep(i,r,l) for(int i=r;i>=l;i--)
using namespace std;
int rd() {
int res=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f*=-1;ch=getchar();}
while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48),ch=getchar();
return res*f;
}
int a[N];
bool check(int now) {
rep(i,1,now/6) {
rep(j,1,5) if(a[i]!=a[i+j*now/6]) return 0;
}
return 1;
}
bool Check(int now) {
rep(i,1,now/6) {
rep(j,1,1) if(a[i]!=a[i+j*now/6]) return 0;
}
return 1;
}
void Flip() {
printf("? flip\n");
fflush(stdout);
}
void Right() {
printf("? right\n");
fflush(stdout);
}
void Left() {
printf("? left\n");
fflush(stdout);
}
int main() {
srand(time(NULL));
a[1]=rd();
rep(i,1,30) {
if(rand()&1) {
Flip();
a[i]=rd();
}
Right();
a[i+1]=rd();
}
drep(i,30,1) Left(),a[i]=rd();
rep(i,2,400) {
Right();
a[i]=rd();
if(i%6==0&&i>=18&&check(i)) {
printf("! %d\n",i/6);
fflush(stdout);
return 0;
}
}
a[1]=a[400];
int now=1;
while(1) {
Right(),a[++now]=rd();
if((now>=2*60)&&!(now&1)&&Check(now)) {
printf("! %d\n",now/2);
fflush(stdout);
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
0 1 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 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 ...
output:
? right ? flip ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? right ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? flip ? ...
result:
wrong answer Wrong answer: incorrect guess 150 (ans: 5000). Queries used: 773