QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#186004 | #5471. Interactive Number Guessing | chyen | AC ✓ | 2ms | 3744kb | C++14 | 2.1kb | 2023-09-22 22:51:37 | 2023-09-22 22:51:38 |
Judging History
answer
#include<bits/stdc++.h>
#include<bits/extc++.h>
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define mem(x,i) memset((x),(i),sizeof((x)))
using namespace std;
//using namespace __gnu_pbds;
using pii = pair<long long,long long>;
using ld = long double;
using ll = long long;
mt19937 mtrd(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1000000007;
const int mod2 = 998244353;
const ld PI = acos(-1);
#define Bint __int128
#define int long long
namespace DEBUG{
template <typename T, typename T2>
ostream& operator<<(ostream& os, const pair<T, T2>& pr) {
os << "( " << pr.first << ", " << pr.second << ")";
return os;
}
template <typename T>
inline void printv(T l, T r){
cerr << "DEBUG: [ ";
for(; l != r; l++)
cerr << *l << ", ";
cerr << "]" << endl;
}
template <typename T>
inline void _debug(const char* format, T t) {
cerr << format << '=' << t << endl;
}
template <class First, class... Rest>
inline void _debug(const char* format, First first, Rest... rest) {
while (*format != ',')
cerr << *format++;
cerr << '=' << first << ",";
_debug(format + 1, rest...);
}
#define TEST
#ifdef TEST
#define debug(...) cerr << "DEBUG: ",_debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) void(0)
#define printv(...) void(0)
#endif
} // namespace DEBUG
using namespace DEBUG;
/* ---------------------------------------- */
const int LIM = 100000000000000000;
int ans;
int ori;
int ask(int x){
cout << "query " << x << endl;
cin >> x;
return x;
}
int bs(int dec){
int l = 0, r = 9;
while(l < r){
int mid = (l + r + 1) >> 1;
int x = ask(mid * dec);
if(x != ori + mid)
r = mid - 1;
else
l = mid;
}
return l;
}
void solve(){
ori = ask(0);
for(int i = LIM; i; i /= 10){
ans += (9 - bs(i)) * i;
}
cout << "answer " << ans << endl;
}
signed main(){
int t = 1;
// cin >> t;
while(t--)
solve();
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3608kb
input:
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 11 13 14 6 11 13 5 11 4 12
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #2:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
89 85 82 81 76 73 72 94 69 95 94 96 97 89 85 82 90 85 91 83 85 91 92 84 94 87 86 85 91 92 84 94 96 97 89 94 87 86 85 82 81 94 96 79 94 87 86 94 96 97 89 94 87 95 85 91 83 85 91 92 93
output:
query 0 query 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 20000000000000000 query 10000000000000000 query 5000000000000000 query 7000000000000000 query 6000000000000000 query 500000000000000 query 700000000000000 query 800000000000000 query 9000...
result:
ok correct
Test #3:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
88 84 81 80 75 90 91 92 84 81 89 93 86 85 93 86 85 93 86 85 93 86 85 93 95 96 88 93 95 96 88 93 95 87 84 81 80 75 90 91 92 84 90 91 92 84 81 89 84 90 91 83 93 86 94 84 81 89 93 95 87
output:
query 0 query 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 40000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query 700000000000000 query 60...
result:
ok correct
Test #4:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
95 91 97 98 99 100 93 101 91 88 96 100 93 101 91 97 89 91 97 98 90 91 97 98 90 100 102 103 104 91 97 89 100 93 101 91 88 87 82 97 98 81 91 88 96 100 102 94 91 97 89 91 97 98 90 100 93 92 91 97 98 99
output:
query 0 query 500000000000000000 query 200000000000000000 query 300000000000000000 query 400000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query 700000000000000 query 6...
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
75 71 68 76 71 77 78 70 71 77 78 79 80 82 83 84 71 77 78 79 71 77 69 80 82 74 80 73 81 80 82 83 84 71 68 76 80 82 74 80 73 81 80 73 81 71 77 78 79 71 77 78 79 71 77 69 80 82 74 80 73 72
output:
query 0 query 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 40000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 4000000000000000 query 500000000000000 query 7...
result:
ok correct
Test #6:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
78 83 85 77 74 71 70 65 80 81 64 83 85 86 87 83 76 75 83 85 77 74 80 81 82 74 80 81 73 74 71 79 83 85 77 74 80 72 83 76 84 74 80 81 73 83 85 86 87 74 80 81 82 74 80 72 83 76 75 83 85 77
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 50000000000000000 query 20000000000000000 query 10000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 4000000000000000 query 500000000000000 query 700000000000000 query 800...
result:
ok correct
Test #7:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
62 67 60 59 67 60 59 58 55 54 67 69 52 67 60 68 67 69 61 67 60 68 67 69 70 71 67 69 70 62 67 69 70 62 67 69 70 62 58 64 65 57 58 64 65 57 58 64 65 66 67 69 70 71 67 60 59 67 60 59 58 64 56
output:
query 0 query 500000000000000000 query 700000000000000000 query 600000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query 700000000000000 query 800000000000000 query 5000...
result:
ok correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
46 51 53 54 55 51 44 52 51 44 52 51 53 54 55 51 53 45 42 48 49 41 51 53 45 51 53 54 46 42 39 38 51 53 54 37 51 53 54 55 51 44 52 51 53 54 46 42 39 38 51 35 34 51 53 54 55 51 53 45 51 53 54 55
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 7000000000000000 query 6000000000000000 query 500000000000000 query 700000000000000 query 8...
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
89 85 82 90 94 87 86 85 91 83 85 91 92 84 85 82 90 85 91 83 85 91 92 84 94 96 88 94 96 88 94 96 97 89 85 82 90 94 87 95 85 91 92 84 85 91 92 84 94 96 88 85 91 83 94 87 95 94 87 95
output:
query 0 query 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 500000000000000 query 200000000000000 query 300000000000000 query 4000...
result:
ok correct
Test #10:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
63 68 61 69 68 70 71 63 68 70 71 63 59 65 57 68 61 69 68 70 71 63 68 61 69 59 65 66 58 68 70 71 72 59 56 64 59 56 55 50 47 46 68 70 71 45 68 61 60 68 70 62 68 70 62 68 61 69 68 70 71 72
output:
query 0 query 500000000000000000 query 700000000000000000 query 600000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 query 500000000000000 query 2...
result:
ok correct
Test #11:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
84 89 91 92 93 80 86 87 79 80 77 76 89 73 90 89 82 90 80 86 78 89 82 81 80 77 76 89 91 92 93 89 91 92 93 89 91 83 80 77 85 80 77 76 71 68 67 62 86 87 61 89 91 83 89 82 81 89 82 90
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 40000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query...
result:
ok correct
Test #12:
score: 0
Accepted
time: 1ms
memory: 3680kb
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 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #13:
score: 0
Accepted
time: 1ms
memory: 3688kb
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 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3692kb
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 500000000000000000 query 700000000000000000 query 800000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 500000000000000 query 700000000000000 query 800000000000000 query 5000...
result:
ok correct
Test #15:
score: 0
Accepted
time: 1ms
memory: 3744kb
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 500000000000000000 query 700000000000000000 query 600000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 7000000000000000 query 6000000000000000 query 500000000000000 query 700000000000000 query 600000000000000 query 5000...
result:
ok correct
Test #16:
score: 0
Accepted
time: 1ms
memory: 3560kb
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 500000000000000000 query 700000000000000000 query 600000000000000000 query 50000000000000000 query 70000000000000000 query 60000000000000000 query 5000000000000000 query 7000000000000000 query 6000000000000000 query 500000000000000 query 700000000000000 query 600000000000000 query 5000...
result:
ok correct
Test #17:
score: 0
Accepted
time: 1ms
memory: 3708kb
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 500000000000000000 query 200000000000000000 query 300000000000000000 query 400000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 40000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 4000000000000000 quer...
result:
ok correct
Test #18:
score: 0
Accepted
time: 1ms
memory: 3532kb
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 500000000000000000 query 200000000000000000 query 300000000000000000 query 400000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 40000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 4000000000000000 quer...
result:
ok correct
Test #19:
score: 0
Accepted
time: 1ms
memory: 3744kb
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 500000000000000000 query 200000000000000000 query 300000000000000000 query 50000000000000000 query 20000000000000000 query 30000000000000000 query 5000000000000000 query 2000000000000000 query 3000000000000000 query 500000000000000 query 200000000000000 query 300000000000000 query 5000...
result:
ok correct
Test #20:
score: 0
Accepted
time: 1ms
memory: 3680kb
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 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 20000000000000000 query 10000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query 200000000000000 query 100000000000000 query 5000...
result:
ok correct
Test #21:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
162 158 155 154 149 146 145 140 137 136 131 128 127 122 119 118 113 110 109 104 101 100 95 92 91 86 83 82 77 74 73 68 65 64 59 56 55 50 47 46 41 38 37 32 29 28 23 20 19 14 11 10 5 2 1
output:
query 0 query 500000000000000000 query 200000000000000000 query 100000000000000000 query 50000000000000000 query 20000000000000000 query 10000000000000000 query 5000000000000000 query 2000000000000000 query 1000000000000000 query 500000000000000 query 200000000000000 query 100000000000000 query 5000...
result:
ok correct
Test #22:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
10 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 6 12 13 14 6 12 13 14
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #23:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
15 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 11 8 7 2 17 18 1
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 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 9 11 3 9 11 3
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #25:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
9 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 14 16 8 5 11 3
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct
Test #26:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
10 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 6 3 11 15 17 9
output:
query 0 query 500000000000000000 query 700000000000000000 query 800000000000000000 query 900000000000000000 query 50000000000000000 query 70000000000000000 query 80000000000000000 query 90000000000000000 query 5000000000000000 query 7000000000000000 query 8000000000000000 query 9000000000000000 quer...
result:
ok correct