QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103639 | #5471. Interactive Number Guessing | wytang1010 | WA | 2ms | 3768kb | C++17 | 1.3kb | 2023-05-07 05:40:40 | 2023-05-07 05:40:43 |
Judging History
answer
/*
* author: weiyutang
*/
#include <bits/stdc++.h>
using namespace std;
/* ===== BEGIN USER CODE ===== */
#define ll long long
#define ld long double
#define f first
#define s second
const int MOD = 1e9 + 7;
const vector<vector<int>> dirs4 {{0,1}, {1,0}, {-1,0}, {0,-1}};
const vector<vector<int>> dirs8 {{0,1}, {1,0}, {-1,0}, {0,-1}, {-1,-1}, {-1,1}, {1,-1}, {1,1}};
void solve() {
int n = 18;
vector<int64_t> digit(n, 0);
int64_t start;
cout << "query " << 0 << endl;
cin >> start;
int64_t pow_10 = 1;
for (int i = 0; i < n; i++) {
int64_t lt = 1, rt = 10;
int64_t resp;
while (lt < rt) {
int64_t mid = lt + (rt - lt) / 2;
cout << "query " << mid * pow_10 << endl;
cin >> resp;
if (resp < start) {
rt = mid;
} else {
lt = mid + 1;
}
}
// cout << "digit[" << i << "]: " << (10 - rt) % 10 << endl;
digit[i] = (10 - rt) % 10;
pow_10 *= 10;
}
int64_t ans = 0;
for (int i = n - 1; i >= 0; i--) {
ans *= 10;
ans += digit[i];
}
cout << ans << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
srand(chrono::steady_clock::now().time_since_epoch().count());
int t = 1;
// cin >> t;
while (t--) {
solve();
}
cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3768kb
input:
6 11 5 4 12 11 5 13 11 14 6 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15 11 14 15
output:
query 0 query 5 query 8 query 7 query 6 query 50 query 80 query 70 query 500 query 800 query 900 query 5000 query 8000 query 9000 query 50000 query 80000 query 90000 query 500000 query 800000 query 900000 query 5000000 query 8000000 query 9000000 query 50000000 query 80000000 query 90000000 query 50...
result:
wrong answer invalid type: 23