QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#277456 | #5471. Interactive Number Guessing | MasterTaster | WA | 1ms | 3308kb | C++14 | 809b | 2023-12-06 19:07:53 | 2023-12-06 19:07:54 |
Judging History
answer
#include <iostream>
#define ll long long
using namespace std;
ll sum, ret, na[20], cifra[20];
void pitaj(ll a)
{
cout<<"query "<<a<<endl;
cin>>ret;
}
bool check(ll c, ll k)
{
pitaj(c*(na[k]));
return (ret==(sum+c));
}
int main() {
na[0]=1;
for(int i=1; i<18; i++) na[i]=10LL*na[i-1];
pitaj(0LL);
sum=ret;
for (ll i=17; i>=0; i--)
{
int l=0, r=9;
int ress=0;
while (l<=r)
{
ll mid=l+(r-l)/2;
if (check(mid, i))
{
ress=mid;
l=mid+1;
}
else
r=mid-1;
}
cifra[i]=ress;
}
cout<<"answer ";
for (int i=17; i>=0; i--) cout<<cifra[i];
cout<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3308kb
input:
6 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 15 10 13 14 6 10 13 5 10 4 11 12
output:
query 0 query 400000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 40000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 4000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
wrong answer wrong guess: 999999999999999876 actual: 123