QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#304947 | #5471. Interactive Number Guessing | SultanAA | WA | 1ms | 3464kb | C++20 | 682b | 2024-01-14 07:44:04 | 2024-01-14 07:44:04 |
Judging History
answer
#include <bits/stdc++.h>
#define uset unordered_set
using namespace std;
int main() {
int d;
cout << "query 0\n";
cout.flush(); cin >> d;
string ans = "";
for (int digit = 0; digit <= 17; digit++) {
int l = 1, r = 10;
while(r >= l) {
int mid = (l+r)/2;
int digitsum;
cout << "query " << mid << string(digit, '0') << "\n"; cout.flush();
cin >> digitsum;
if (digitsum > d) l = mid+1;
if (digitsum <= d) r = mid-1;
}
cout << l << " " << r << "\n";
ans.push_back(10 - min(l,10) + '0');
}
reverse(ans.begin(), ans.end());
cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3464kb
input:
6 11 5 12 4
output:
query 0 query 5 query 8 query 6 query 7 7 6 query 50
result:
wrong answer invalid type: 7