QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190108 | #5471. Interactive Number Guessing | koifish# | AC ✓ | 1ms | 3720kb | C++14 | 2.3kb | 2023-09-28 11:36:52 | 2023-09-28 11:36:52 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define vpii vector<pi>
#define il inline
#define ri register
#define all(a) a.begin(), a.end()
#define fr(a) freopen(a, "r", stdin)
#define fo(a) freopen(a, "w", stdout);
#define mod 998244353
#define debug puts("------------------------")
#define lowbit(x) (x&-x)
#define ls(x) x << 1
#define rs(x) x << 1 | 1
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;}
void Read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
int read() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
#define LOCAL
using namespace std;
const int maxn = 200005;
/**/
int pw[maxn];
/**/
int query(int x)
{
cout << "query " << x << "\n";
fflush(stdout);
return read();
}
signed main()
{
pw[0] = 1;
for(int i = 1; i < 18; i++) pw[i] = pw[i - 1] * 10;
int nw = query(0), ans = 0;
for(int i = 0; i < 18; i++)
{
int res = 0;
if(query(5*pw[i]) - nw == 5) // 0 1 2 3 4
{
if(query(7*pw[i]) - nw == 7) // 0 1 2
{
if(query(8*pw[i]) - nw == 8) // 0 1
{
if(query(9*pw[i]) - nw == 9) // 0
res = 0;
else
res = 1;
}
else // 2
res = 2;
}
else // 3 4
{
if(query(6*pw[i]) - nw == 6)
res = 3;
else res = 4;
}
}
else // 5 6 7 8 9
{
if(query(2*pw[i])-nw==2) // 5 6 7
{
if(query(3*pw[i])-nw==3)
{
if(query(4*pw[i])-nw==4)
res = 5;
else res = 6;
}
else
res = 7;
}
else // 8 9
{
if(query(1*pw[i])-nw==1) // 8
res = 8;
else
res = 9;
}
}
ans += res * pw[i];
}
cout << "answer " << ans << "\n";
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3700kb
input:
6 11 4 12 11 13 5 11 13 14 6 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15 11 13 14 15
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
89 85 91 92 93 85 91 83 94 87 95 94 96 97 89 94 87 86 94 96 79 85 82 81 94 87 86 94 96 97 89 85 91 92 84 94 87 86 85 91 92 84 85 91 83 85 82 90 94 96 97 89 94 69 95 76 73 72 85 82 81
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 500 query 700 query 600 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 60000 query 500000 query 700000 query 800000 query 5000000 query 2000000 query 1000000 query 50000000 query 70000000 query 600000...
result:
ok correct
Test #3:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
88 93 95 87 84 81 89 93 86 94 84 90 91 83 84 81 89 84 90 91 92 75 90 91 92 84 81 80 93 95 87 93 95 96 88 93 95 96 88 93 86 85 93 86 85 93 86 85 93 86 85 84 81 89 75 90 91 92 84 81 80
output:
query 0 query 5 query 7 query 8 query 50 query 20 query 10 query 500 query 700 query 600 query 5000 query 2000 query 3000 query 4000 query 50000 query 20000 query 10000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 2000000 query 3000000 query 4000000 query 50000000 query 20...
result:
ok correct
Test #4:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
95 91 97 98 99 100 93 92 91 97 98 90 91 97 89 100 102 94 91 88 96 82 97 98 81 91 88 87 100 93 101 91 97 89 100 102 103 104 91 97 98 90 91 97 98 90 91 97 89 100 93 101 91 88 96 100 93 101 91 97 98 99
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 70 query 60 query 500 query 200 query 300 query 400 query 5000 query 2000 query 3000 query 50000 query 70000 query 80000 query 500000 query 200000 query 100000 query 5000000 query 2000000 query 3000000 query 4000000 query 50000000 query 20000000...
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
75 80 73 72 80 82 74 71 77 69 71 77 78 79 71 77 78 79 80 73 81 80 73 81 80 82 74 71 68 76 80 82 83 84 80 73 81 80 82 74 71 77 69 71 77 78 79 80 82 83 84 71 77 78 79 71 77 78 70 71 68 76
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 80 query 500 query 200 query 300 query 5000 query 2000 query 3000 query 4000 query 50000 query 20000 query 30000 query 40000 query 500000 query 700000 query 600000 query 5000000 query 7000000 query 6000000 query 50000000 query 70000000 query 80...
result:
ok correct
Test #6:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
78 83 85 77 83 76 75 74 80 72 74 80 81 82 83 85 86 87 74 80 81 73 83 76 84 74 80 72 83 85 77 74 71 79 74 80 81 73 74 80 81 82 83 85 77 83 76 75 83 85 86 87 65 80 81 64 74 71 70 83 85 77
output:
query 0 query 5 query 7 query 8 query 50 query 70 query 60 query 500 query 200 query 300 query 5000 query 2000 query 3000 query 4000 query 50000 query 70000 query 80000 query 90000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 7000000 query 6000000 query 50000000 query 2000...
result:
ok correct
Test #7:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
62 58 64 56 67 60 59 67 60 59 67 69 70 71 58 64 65 66 58 64 65 57 58 64 65 57 67 69 70 62 67 69 70 62 67 69 70 62 67 69 70 71 67 60 68 67 69 61 67 60 68 67 69 52 58 55 54 67 60 59 67 60 59
output:
query 0 query 5 query 2 query 3 query 50 query 70 query 60 query 500 query 700 query 600 query 5000 query 7000 query 8000 query 9000 query 50000 query 20000 query 30000 query 40000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 2000000 query 3000000 query 4000000 query 50000...
result:
ok correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
46 51 53 54 55 51 53 45 51 53 54 55 51 35 34 42 39 38 51 53 54 46 51 44 52 51 53 54 55 51 53 54 37 42 39 38 51 53 54 46 51 53 45 42 48 49 41 51 53 45 51 53 54 55 51 44 52 51 44 52 51 53 54 55
output:
query 0 query 5 query 7 query 8 query 9 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 6000 query 50000 query 20000 query 10000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 6000000 query 50000000 query 70000000 ...
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
89 94 87 95 94 87 95 85 91 83 94 96 88 85 91 92 84 85 91 92 84 94 87 95 85 82 90 94 96 97 89 94 96 88 94 96 88 85 91 92 84 85 91 83 85 82 90 85 91 92 84 85 91 83 94 87 86 85 82 90
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 60 query 500 query 200 query 300 query 5000 query 7000 query 8000 query 50000 query 20000 query 30000 query 40000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 7000000 query 6000000 query 50000000 query 20000000 query ...
result:
ok correct
Test #10:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
63 68 70 71 72 68 61 69 68 70 62 68 70 62 68 61 60 68 70 71 45 50 47 46 59 56 55 59 56 64 68 70 71 72 59 65 66 58 68 61 69 68 70 71 63 68 61 69 59 65 57 68 70 71 63 68 70 71 63 68 61 69
output:
query 0 query 5 query 7 query 8 query 9 query 50 query 70 query 60 query 500 query 700 query 800 query 5000 query 7000 query 8000 query 50000 query 70000 query 60000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 2000000 query 1000000 query 50000000 query 20000000 query 1000...
result:
ok correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
84 89 82 90 89 82 81 89 91 83 62 86 87 61 71 68 67 80 77 76 80 77 85 89 91 83 89 91 92 93 89 91 92 93 80 77 76 89 82 81 80 86 78 89 82 90 89 73 90 80 77 76 80 86 87 79 89 91 92 93
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 60 query 500 query 700 query 800 query 5000 query 2000 query 3000 query 4000 query 50000 query 20000 query 10000 query 500000 query 200000 query 100000 query 5000000 query 2000000 query 1000000 query 50000000 query 70000000 query 80000000 query...
result:
ok correct
Test #12:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
0 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9 5 7 8 9
output:
query 0 query 5 query 7 query 8 query 9 query 50 query 70 query 80 query 90 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 800000...
result:
ok correct
Test #13:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18 23 25 26 18
output:
query 0 query 5 query 7 query 8 query 9 query 50 query 70 query 80 query 90 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 800000...
result:
ok correct
Test #14:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
36 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35 41 43 35
output:
query 0 query 5 query 7 query 8 query 50 query 70 query 80 query 500 query 700 query 800 query 5000 query 7000 query 8000 query 50000 query 70000 query 80000 query 500000 query 700000 query 800000 query 5000000 query 7000000 query 8000000 query 50000000 query 70000000 query 80000000 query 500000000 ...
result:
ok correct
Test #15:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
54 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60 59 52 60
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 60 query 500 query 700 query 600 query 5000 query 7000 query 6000 query 50000 query 70000 query 60000 query 500000 query 700000 query 600000 query 5000000 query 7000000 query 6000000 query 50000000 query 70000000 query 60000000 query 500000000 ...
result:
ok correct
Test #16:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
72 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69 77 70 69
output:
query 0 query 5 query 7 query 6 query 50 query 70 query 60 query 500 query 700 query 600 query 5000 query 7000 query 6000 query 50000 query 70000 query 60000 query 500000 query 700000 query 600000 query 5000000 query 7000000 query 6000000 query 50000000 query 70000000 query 60000000 query 500000000 ...
result:
ok correct
Test #17:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
90 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94 86 92 93 94
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 40 query 500 query 200 query 300 query 400 query 5000 query 2000 query 3000 query 4000 query 50000 query 20000 query 30000 query 40000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 2000000 query 300000...
result:
ok correct
Test #18:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
108 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103 104 110 111 103
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 40 query 500 query 200 query 300 query 400 query 5000 query 2000 query 3000 query 4000 query 50000 query 20000 query 30000 query 40000 query 500000 query 200000 query 300000 query 400000 query 5000000 query 2000000 query 300000...
result:
ok correct
Test #19:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
126 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120 122 128 120
output:
query 0 query 5 query 2 query 3 query 50 query 20 query 30 query 500 query 200 query 300 query 5000 query 2000 query 3000 query 50000 query 20000 query 30000 query 500000 query 200000 query 300000 query 5000000 query 2000000 query 3000000 query 50000000 query 20000000 query 30000000 query 500000000 ...
result:
ok correct
Test #20:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
144 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145 140 137 145
output:
query 0 query 5 query 2 query 1 query 50 query 20 query 10 query 500 query 200 query 100 query 5000 query 2000 query 1000 query 50000 query 20000 query 10000 query 500000 query 200000 query 100000 query 5000000 query 2000000 query 1000000 query 50000000 query 20000000 query 10000000 query 500000000 ...
result:
ok correct
Test #21:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
162 5 2 1 14 11 10 23 20 19 32 29 28 41 38 37 50 47 46 59 56 55 68 65 64 77 74 73 86 83 82 95 92 91 104 101 100 113 110 109 122 119 118 131 128 127 140 137 136 149 146 145 158 155 154
output:
query 0 query 5 query 2 query 1 query 50 query 20 query 10 query 500 query 200 query 100 query 5000 query 2000 query 1000 query 50000 query 20000 query 10000 query 500000 query 200000 query 100000 query 5000000 query 2000000 query 1000000 query 50000000 query 20000000 query 10000000 query 500000000 ...
result:
ok correct
Test #22:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
10 6 12 13 14 6 12 13 14 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 30 query 40 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 800000...
result:
ok correct
Test #23:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
15 2 17 18 1 11 8 7 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24 20 22 23 24
output:
query 0 query 5 query 2 query 3 query 4 query 50 query 20 query 10 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9...
result:
ok correct
Test #24:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
4 9 11 3 9 11 3 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13 9 11 12 13
output:
query 0 query 5 query 7 query 8 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
ok correct
Test #25:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
9 5 11 3 14 16 8 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18 14 16 17 18
output:
query 0 query 5 query 2 query 3 query 50 query 70 query 80 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
ok correct
Test #26:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
10 15 17 9 6 3 11 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19 15 17 18 19
output:
query 0 query 5 query 7 query 8 query 50 query 20 query 10 query 500 query 700 query 800 query 900 query 5000 query 7000 query 8000 query 9000 query 50000 query 70000 query 80000 query 90000 query 500000 query 700000 query 800000 query 900000 query 5000000 query 7000000 query 8000000 query 9000000 q...
result:
ok correct