#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N){
int l = 1, r = N, mid;
int ask = max(N / 2, 1);
Guess(ask);
while(l < r){
int nask = min(max(l + r - ask, r / 3 + 1), N - ((N - l)/3));
if(nask == ask) nask++;
if(nask > N) nask = N - (ask == N);
mid = (ask + nask) / 2;
int g = Guess(nask);
if(ask > nask) g = -g;
if(g == 1) l = mid + 1;
else if(g == -1){
if((ask + nask) % 2 == 0) r = mid - 1;
else r = mid;
}
else return (ask + nask) / 2;
ask = nask;
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
6744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
6768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
509 ms |
8280 KB |
Output is partially correct - alpha = 0.600000000000 |