# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
361467 |
2021-01-30T09:31:38 Z |
phathnv |
Colors (BOI20_colors) |
C++11 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int Ask(ll x){
cout << "? " << x << endl;
int res;
cin >> res;
return res;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
ll l = 1, r = n - 1, start = 1, cur = -1, dir = -1;
while (l <= r){
int mid = (l + r) >> 1;
cur += mid * dir;
dir *= -1;
l = mid + 1;
start = max(start, -cur);
}
l = 1, r = n - 1, cur = start, dir = -1;
Ask(start);
ll answer = n;
while (l <= r){
int mid = (l + r) >> 1;
cur += mid * dir;
dir *= -1;
if (Ask(cur)){
answer = mid;
l = mid + 1;
} else {
r = mid - 1;
}
}
cout << "= " << answer << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong guess |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong guess |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong guess |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong guess |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong guess |
2 |
Halted |
0 ms |
0 KB |
- |