QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#223969 | #5471. Interactive Number Guessing | ivaziva | WA | 1ms | 3824kb | C++14 | 942b | 2023-10-22 22:38:42 | 2023-10-22 22:38:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long stepen=1;
long long br=0;
vector<long long> vec;
cout<<"query 0"<<endl;
long long sum; cin>>sum;
while (br<=18)
{
long long l=0;
long long r=9;
long long rez=-1;
while (l<=r)
{
long long mid=(l+r)/2;
cout<<"query "<<stepen*mid<<endl;
long long pos; cin>>pos;
if (pos<sum)
{
rez=mid;
r=mid-1;
}
else l=mid+1;
}
if (rez==-1) vec.push_back(0);
else vec.push_back(10-rez);
stepen*=10;
br++;
}
reverse(vec.begin(),vec.end());
cout<<"answer ";
bool da=false;
for (long long i=0;i<vec.size();i++)
{
if (vec[i]==0 and da) cout<<0;
else if (vec[i]!=0) cout<<vec[i];
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
6 10 4 11 12 10 13 5 10 13 14 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
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 80 query 400 query 700 query 800 query 900 query 4000 query 7000 query 8000 query 9000 query 40000 query 70000 query 80000 query 90000 query 400000 query 700000 query 800000 query 900000 query 4000000 query 7000000 query 8000000 query 9...
result:
wrong answer invalid range in query_count=72: 4000000000000000000