QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#438286 | #5471. Interactive Number Guessing | grass8cow# | WA | 1ms | 3816kb | C++17 | 477b | 2024-06-10 15:02:48 | 2024-06-10 15:02:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll Ask(ll x){
printf("query %lld\n",x);fflush(stdout);
scanf("%lld",&x);return x;
}
int main(){
ll t0=Ask(0);
ll x=0,z=1;
for(int i=0;i<2;i++,z*=10){
int l=1,r=9,p=0;
while(l<=r){
int mi=(l+r)>>1;
if(Ask(z*mi)==t0+mi)p=mi,l=mi+1;
else r=mi-1;
}
x+=z*(9-p);
}
printf("%lld\n",x);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3816kb
input:
6 11 4 12 11 13 5
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 23
result:
wrong answer invalid type: 23