#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int n){
Guess(1);
int l = 1, r = n;
int last = 0, pre = 1;
while(l < r) {
if(last == 0) {
int now = Guess(r);
if(now == 0) return (pre + r) / 2;
else if(now == 1) {
l = (l + r) / 2 + 1;
pre = r, last = 1;
} else {
r = (l + r + 1) / 2 - 1;
Guess(pre);
}
} else {
int now = Guess(l);
if(now == 0) return (pre + l) / 2;
else if(now == 1) {
r = (l + r + 1) / 2 - 1;
pre = l, last = 0;
} else {
l = (l + r) / 2 + 1;
Guess(pre);
}
}
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
734 ms |
8312 KB |
Output is partially correct - alpha = 0.080000000000 |