QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#516518 | #8216. Jumbled Primes | uuku | TL | 0ms | 0kb | C++14 | 692b | 2024-08-12 17:52:39 | 2024-08-12 17:52:41 |
answer
#include<bits/stdc++.h>
using namespace std;
int Read(){
int x=0;char ch=getchar();bool f=0;
while(!isdigit(ch)) if(ch=='-') f=1,ch=getchar(); else ch=getchar();
while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
return f?-x:x;
}
bool ans[105];
int main(){
int T=1000;
while(T--){
for(int i=1;i<=100;i++) ans[i]=1;
for(int i=1;i<=100;i++){
if(!ans[i]) continue;
for(int j=i+1;j<=100;j++){
printf("? %d %d\n",i,j);
fflush(stdout);
int x=Read();
if(x!=1){
ans[i]=0;
ans[j]=0;break;
}
}
}
printf("! ");
for(int i=1;i<=100;i++) printf("%d",ans[i]);
printf("\n");
fflush(stdout);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
1 1 1 3 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 25 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
? 1 2 ? 1 3 ? 1 4 ? 1 5 ? 2 3 ? 2 4 ? 2 5 ? 2 6 ? 2 7 ? 2 8 ? 3 4 ? 3 5 ? 3 6 ? 3 7 ? 3 8 ? 3 9 ? 3 10 ? 3 11 ? 3 12 ? 3 13 ? 3 14 ? 3 15 ? 3 16 ? 3 17 ? 3 18 ? 3 19 ? 3 20 ? 3 21 ? 3 22 ? 3 23 ? 3 24 ? 3 25 ? 3 26 ? 3 27 ? 3 28 ? 3 29 ? 3 30 ? 3 31 ? 3 32 ? 3 33 ? 3 34 ? 3 35 ? 3 36 ? 3 37 ? 3 38 ?...