#include <bits/stdc++.h>
#include "grader.h"
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
using namespace std;
int Guess (int x);
int last = 1;
int ans;
// int Guess (int x) {
// cout << x << '\n';
// if(abs(last - ans) == abs(x - ans)) return 0;
// else if(abs(last - ans) > abs(x - ans)) return 1;
// return -1;
// }
int HC(int n){
int l = 1, r = n;
last = 1;
Guess(1);
while(l < r) {
// if(last != l && last != r) {
// Guess(l); last = l;
// }
int mid = (l + r) / 2;
int now = mid * 2 - last;
now = min(now, n); now = max(now, 1);
int k = Guess(now);
// last = l ^ r ^ last;
if(k == 0) {
return (last + now) / 2;
}
else if((k == 1 && now > last) || (k == -1 && now < last)) {
l = (last + now) / 2 + 1;
}
else {
r = (last + now + 1) / 2 - 1;
}
last = now;
}
return l;
}
// int main() {
// int n;
// cin >> n >> ans;
// cout << HC(n) << '\n';
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
1676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
578 ms |
8648 KB |
Output isn't correct - alpha = 0.000000000000 |