#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N){
int l=1;
int r=N;
while(l<r){
int m=(l+r)/2;
int x=Guess(m);
int y=Guess(m+1);
if(y==-1){
int z=Guess(l);
r=m+1;
if(z==1){
r=(l+r-1)/2;
}
else if(z==0){
return (l+r)/2;
}
else{
l=(l+r+1)/2;
}
}
else{
int z=Guess(r);
l=m+1;
if(z==1){
l=(r+l+1)/2;
}
else if(z==0){
return (l+r)/2;
}
else{
r=(r+l-1)/2;
}
}
}
return l;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |