QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#223989 | #5471. Interactive Number Guessing | Danilo21 | WA | 0ms | 3672kb | C++17 | 1.8kb | 2023-10-22 22:48:00 | 2023-10-22 22:48:01 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define en '\n'
#define sp ' '
#define tb '\t'
#define ri(n) int n; cin >> n
#define rl(n) ll n; cin >> n
#define rs(s) string s; cin >> s
#define rc(c) char c; cin >> c
#define rv(v) for (auto &x : v) cin >> x
#define pven(v) for (auto x : v) cout << x << en
#define pv(v) for (auto x : v) cout << x << sp; cout << en
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout << "YES" << en
#define no cout << "NO" << en
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define ssort(a, b) if (a < b) swap(a, b)
#define bitcnt(a) (__builtin_popcountll(a))
#define bithigh(a) (63-__builtin_clzll(a))
#define lg bithigh
#define highpow(a) (1LL << (ll)lg(a))
using namespace std;
const ll LINF = 4e18;
const int mxN = 1e6+10, INF = 2e9;
ll n, m;
int Ask(ll a){
cout << "query " << a << endl;
ri(x);
return x;
}
void Answer(ll y){
cout << "answer " << y << endl;
exit(0);
}
void Solve(){
ll y = 0;
ll koef = 1, zero = Ask(0);
for (int i = 0; i < 2; i++){
ll l = 1, r = 9, ans = 10;
while (l <= r){
ll k = (l + r + 1)>>1;
ll x = Ask(koef * k);
if (x != zero + k){
ans = k;
r = k - 1;
}
else l = k + 1;
}
y += (10 - ans) * koef;
koef *= 10;
}
Answer(y);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0); cerr.tie(0);
cout << setprecision(12) << fixed;
cerr << setprecision(12) << fixed;
cerr << "Started!" << endl;
int t = 1;
//cin >> t;
while (t--)
Solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3672kb
input:
6 11 5 4 12 11 5 13
output:
query 0 query 5 query 8 query 7 query 6 query 50 query 80 query 70 answer 23
result:
wrong answer wrong guess: 23 actual: 123