#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int N){
int cnt=1,l=1,r=N,kq=N,val;
int last=N;
val=Guess(N);
while (l<r){
int mid=l+r-last;
mid=max(mid,1);
mid=min(mid,N);
val=Guess(mid);
cnt++;
if (val==0){
kq=(mid+last)/2;
break;
}
if (val==1){
if (last<mid)
l=(last+mid+1)/2;
else{
r=(last+mid-1)/2;
kq=r;
}
last=mid;
continue;
}
if (last<mid){
r=(last+mid-1)/2;
kq=r;
}
else
l=(last+mid+1)/2;
last=mid;
}
return kq;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
1236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
607 ms |
8100 KB |
Output isn't correct - alpha = 0.000000000000 |