QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306569 | #5471. Interactive Number Guessing | erering | WA | 1ms | 3512kb | C++20 | 791b | 2024-01-16 21:49:04 | 2024-01-16 21:49:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
#define int ll
const long long inf=1e18;
const int MOD=1e9+7;
const int N=1e5+5;
signed main()
{
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cout<<"query 0"<<endl;
int sum; cin>>sum;
string s="";
int x=1;
for(int i=1;i<=17;i++){
int l=0,r=9,ans=0;
while(l<=r){
int mid=(l+r)/2;
cout<<"query "<<(10-mid)*x<<endl;
int newsum; cin>>newsum;
if(newsum!=mid+sum){
l=mid+1;
ans=mid;
}
else r=mid-1;
}
string k=to_string(ans);
s+=k;
x*=10;
}
while(s.back()=='0')s.pop_back();
reverse(s.begin(),s.end());
cout<<"answer "<<s;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3512kb
input:
6 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7 12 9 8 7
output:
query 0 query 6 query 3 query 2 query 1 query 60 query 30 query 20 query 10 query 600 query 300 query 200 query 100 query 6000 query 3000 query 2000 query 1000 query 60000 query 30000 query 20000 query 10000 query 600000 query 300000 query 200000 query 100000 query 6000000 query 3000000 query 200000...
result:
wrong answer wrong guess: 99999999999999999 actual: 123