QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#296924 | #5471. Interactive Number Guessing | Naser | WA | 1ms | 3744kb | C++17 | 1.6kb | 2024-01-03 19:51:12 | 2024-01-03 19:51:13 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pii pair<int,int>
#define vint vector<int>
#define vpii vector<pii>
#define pb push_back
#define se second
#define fi first
#define all(x) x.begin(), x.end()
#define graph vector<vint>
using namespace std;
const int N = (int)1e5 + 69;
const int mod = (int)1e4 + 7;
const int naser = 3999, tourist = 3662;
int INF = INT_MAX;
int power(int a, int b) { int ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; }
int gcd(int a, int b) { if (b == 0)return a;return gcd(b, a % b); }
int x = 6;
int digsum(int xx) {
int ans = 0;
while (xx) {
ans += xx % 10;
xx /= 10;
}
return ans;
}
int query(int a) {
cout << "query " << a << endl;
cout.flush();
int ans = 0;
//ans = digsum(x + a);
cin >> ans;
return ans;
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string ans;
int sum = query(0);
for (int i = 0; i < 18; i++) {
int dig = power(10, i),num = -1;
int l = 0, r = 9;
while (l <= r) {
int mid = (l + r) / 2;
int tmp = query(mid * dig);
if (sum + mid == tmp)
l = mid + 1, num = mid;
else
r = mid - 1;
}
ans.push_back('0' + 9 - num);
}
reverse(all(ans));
cout << "answer ";
bool x = 0;
for (char c : ans) {
if (c > '0')
x = 1;
if (x)
cout << c;
}
cout << endl;
cout.flush();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3516kb
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:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
89 93 87 85 84 90 91 83 93 87 94 95 93 96 97 89 93 87 94 86 93 96 79 84 81 89 93 87 94 86 93 96 97 89 84 90 91 92 93 87 94 86 84 90 91 92 84 90 91 83 84 90 82 93 96 97 89 93 69 94 95 75 72 89 84 81 89
output:
query 0 query 4 query 7 query 5 query 40 query 10 query 20 query 30 query 400 query 700 query 500 query 600 query 4000 query 7000 query 8000 query 9000 query 40000 query 70000 query 50000 query 60000 query 400000 query 700000 query 800000 query 4000000 query 1000000 query 0 query 40000000 query 7000...
result:
ok correct
Test #3:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
88 92 95 87 83 89 81 92 86 93 94 83 89 90 91 83 89 81 92 86 84 92 77 75 83 80 88 92 95 87 92 95 96 88 92 95 96 88 92 86 93 85 92 86 93 85 92 86 93 85 92 86 93 85 83 89 81 92 77 75 83 80 88
output:
query 0 query 4 query 7 query 8 query 40 query 10 query 20 query 400 query 700 query 500 query 600 query 4000 query 1000 query 2000 query 3000 query 40000 query 10000 query 20000 query 400000 query 700000 query 500000 query 4000000 query 7000000 query 5000000 query 40000000 query 10000000 query 0 qu...
result:
ok correct
Test #4:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
95 99 93 91 99 93 100 92 90 96 97 98 90 96 97 89 99 102 94 90 96 88 81 96 97 98 90 87 95 99 93 100 101 90 96 97 89 99 102 103 104 90 96 97 98 90 96 97 98 90 96 97 89 99 93 100 101 90 96 88 99 93 100 101 99 93 91
output:
query 0 query 4 query 7 query 5 query 40 query 70 query 50 query 60 query 400 query 100 query 200 query 300 query 4000 query 1000 query 2000 query 3000 query 40000 query 70000 query 80000 query 400000 query 100000 query 200000 query 4000000 query 1000000 query 2000000 query 3000000 query 40000000 qu...
result:
ok correct
Test #5:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
75 79 73 80 72 79 82 74 70 76 77 69 79 73 71 79 73 71 79 73 80 81 79 73 80 81 79 82 74 70 76 68 79 82 83 84 79 73 80 81 79 82 74 70 76 77 69 79 73 71 79 82 83 84 79 73 71 70 76 77 78 70 76 68
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 80 query 400 query 100 query 200 query 300 query 4000 query 7000 query 5000 query 40000 query 70000 query 50000 query 400000 query 700000 query 500000 query 600000 query 4000000 query 7000000 query 5000000 query 6000000 query 40000000 q...
result:
ok correct
Test #6:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
78 82 85 77 82 76 83 75 73 79 80 72 82 76 74 82 85 86 87 73 79 80 81 82 76 83 84 73 79 80 72 82 85 77 73 79 71 73 79 80 81 82 76 74 82 85 77 82 76 83 75 82 85 86 87 64 79 80 81 73 70 78 82 85 77
output:
query 0 query 4 query 7 query 8 query 40 query 70 query 50 query 60 query 400 query 100 query 200 query 300 query 4000 query 7000 query 5000 query 40000 query 70000 query 80000 query 90000 query 400000 query 100000 query 200000 query 300000 query 4000000 query 7000000 query 5000000 query 6000000 que...
result:
ok correct
Test #7:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
62 57 63 64 56 66 60 67 59 66 60 67 59 66 69 70 71 66 60 58 57 63 64 65 57 63 64 65 66 69 70 62 66 69 70 62 66 69 70 62 66 69 70 71 66 60 67 68 66 69 61 66 60 67 68 66 69 52 57 54 62 66 60 67 59 66 60 67 59
output:
query 0 query 4 query 1 query 2 query 3 query 40 query 70 query 50 query 60 query 400 query 700 query 500 query 600 query 4000 query 7000 query 8000 query 9000 query 40000 query 70000 query 50000 query 400000 query 100000 query 200000 query 300000 query 4000000 query 1000000 query 2000000 query 3000...
result:
ok correct
Test #8:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
46 50 53 54 55 50 53 45 50 53 54 55 50 35 51 34 41 38 46 50 53 54 46 50 44 51 52 50 53 54 55 50 53 54 37 41 38 46 50 53 54 46 50 53 45 41 47 48 49 50 53 45 50 53 54 55 50 44 51 52 50 44 51 52 50 53 54 55
output:
query 0 query 4 query 7 query 8 query 9 query 40 query 70 query 80 query 400 query 700 query 800 query 900 query 4000 query 7000 query 5000 query 6000 query 40000 query 10000 query 0 query 400000 query 700000 query 800000 query 900000 query 4000000 query 7000000 query 5000000 query 6000000 query 400...
result:
ok correct
Test #9:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
89 93 87 94 95 93 87 94 95 84 90 91 83 93 96 88 84 90 91 92 84 90 91 92 93 87 94 95 84 90 82 93 96 97 89 93 96 88 93 96 88 84 90 91 92 84 90 91 83 84 90 82 84 90 91 92 84 90 91 83 93 87 94 86 84 90 82
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 50 query 60 query 400 query 100 query 200 query 300 query 4000 query 7000 query 8000 query 40000 query 10000 query 20000 query 30000 query 400000 query 100000 query 200000 query 300000 query 4000000 query 7000000 query 5000000 query 600...
result:
ok correct
Test #10:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
63 67 70 71 72 67 61 68 69 67 70 62 67 70 62 67 61 68 60 67 70 71 45 49 46 63 58 55 63 58 64 56 67 70 71 72 58 64 65 66 67 61 68 69 67 70 71 63 67 61 68 69 58 64 65 57 67 70 71 63 67 70 71 63 67 61 68 69
output:
query 0 query 4 query 7 query 8 query 9 query 40 query 70 query 50 query 60 query 400 query 700 query 800 query 4000 query 7000 query 8000 query 40000 query 70000 query 50000 query 60000 query 400000 query 700000 query 800000 query 900000 query 4000000 query 1000000 query 0 query 40000000 query 1000...
result:
ok correct
Test #11:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
84 88 82 89 90 88 82 89 81 88 91 83 61 85 86 87 70 67 84 79 76 84 79 85 77 88 91 83 88 91 92 93 88 91 92 93 79 76 84 88 82 89 81 79 85 86 78 88 82 89 90 88 73 89 90 79 76 84 79 85 86 87 88 91 92 93
output:
query 0 query 4 query 7 query 5 query 6 query 40 query 70 query 50 query 60 query 400 query 700 query 800 query 4000 query 1000 query 2000 query 3000 query 40000 query 10000 query 0 query 400000 query 100000 query 0 query 4000000 query 1000000 query 2000000 query 40000000 query 70000000 query 800000...
result:
ok correct
Test #12:
score: -100
Wrong Answer
time: 1ms
memory: 3516kb
input:
0 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9 4 7 8 9
output:
query 0 query 4 query 7 query 8 query 9 query 40 query 70 query 80 query 90 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 800000...
result:
wrong answer format Unexpected end of file - int64 expected