#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int N){
int lo = 1;
int hi = N;
int last = (lo+hi)/2;
Guess(last);
while(lo<hi){
int now = hi - (last - lo);
now = max(now,1);
now = min(now,N);
// cout << "!" << lo << " " << hi << " " << last << " " << now << endl;
if(now==last && now-1>=lo){
now--;
}
else if(now==last && now+1<=hi){
now++;
}
else if(now==last){
assert(false);
}
int res = Guess(now);
if(res==0){
// cout << "RETURN 1 " << (now+last)/2 << endl;
return (now+last)/2;
}
int close = last;
int far = now;
if(res==1){
swap(close,far);
}
if(close<far){
int mid = (close+far-1)/2;
hi = mid;
}
else{
int mid = (close+far)/2 + 1;
lo = mid;
}
last = now;
}
// cout << "RETURN 2 " << lo << endl;
return lo;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
723 ms |
8184 KB |
Output is partially correct - alpha = 0.208333333333 |