#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
1376 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
1280 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
700 ms |
9836 KB |
Output isn't correct - alpha = 0.000000000000 |