#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int N){
int l=1,r=N;
int a;
int prevv = -1;
a = Guess(1);
bool left = true;
while(l<r){
//std::cout << l << "\t" << r << '\n';
int mid = (l+r)/2;
if(mid==prevv)mid++;
prevv = mid;
if(left){
a = Guess(r);
//std::cout << l << "\t" << r << '\t' << mid <<'\n';
if(a==1)//close to r
l = mid;
else{//close to l
r= mid;
Guess(r);
}
}else{
a = Guess(l);
//std::cout << l << "\t" << r << '\t' << mid <<'\n';
if(a==1)//close to l
r = mid;
else{//close to r
l= mid;
Guess(l);
}
}
left^=1;
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
1260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1376 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1280 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
700 ms |
9836 KB |
Output isn't correct - alpha = 0.000000000000 |