# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
484709 |
2021-11-05T08:10:55 Z |
ac2hu |
Colors (BOI20_colors) |
C++14 |
|
1 ms |
200 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
map<ll,bool> used;
ll n;
bool good(ll mid, ll &cur){
if(cur + mid <= n && !used[cur + mid]){
cur += mid;
used[cur] = true;
cout << "? " << cur << endl;
bool a;cin >> a;
return a;
}
else if(cur - mid > 0 && !used[cur - mid]){
cur -= mid;
used[cur] = true;
cout << "? " << cur << endl;
bool a;cin >> a;
return a;
}
cout << "= " << 1e9 << endl;
return false;
}
signed main(){
cin >> n;
ll cur = 0;
good(1,cur);
ll l = 1,r = n;
while(l < r){
ll mid = (l + r)/2;
if(good(mid,cur)){
r = mid;
}
else{
l = mid + 1;
}
}
cout << "= "<< l << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
OK (4 queries) |
2 |
Incorrect |
1 ms |
200 KB |
Expected integer, but "1e+09" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
OK (4 queries) |
2 |
Incorrect |
1 ms |
200 KB |
Expected integer, but "1e+09" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
OK (4 queries) |
2 |
Incorrect |
1 ms |
200 KB |
Expected integer, but "1e+09" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
OK (4 queries) |
2 |
Incorrect |
1 ms |
200 KB |
Expected integer, but "1e+09" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
OK (4 queries) |
2 |
Incorrect |
1 ms |
200 KB |
Expected integer, but "1e+09" found |
3 |
Halted |
0 ms |
0 KB |
- |