#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int mx=0;
int HC(int N){
int l=1,r=N,m,cnt=1,tmp;
Guess(l);
tmp=Guess(r);
for(;;){
m=(l+r)/2;
if (tmp==0)return m;
else if (tmp==1){
if (cnt==1){
l=m+1,cnt=0;
tmp=Guess(m+1);
if (l+1==r){
if (tmp==1)return l;
else return r;
}
}
else{
r=m,cnt=1;
tmp=Guess(m);
if (l+1==r){
if (tmp==1)return r;
else return l;
}
}
}else{//tmp==-1
if (cnt==1){
Guess(l);
r=m,cnt=1;
tmp=Guess(m);
if (l+1==r){
if (tmp==1)return r;
else return l;
}
}else{
Guess(r);
l=m+1,cnt=0;
tmp=Guess(m+1);
if (l+1==r){
if (tmp==1)return l;
else return r;
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
737 ms |
8184 KB |
Output isn't correct - alpha = 0.000000000000 |