This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
#include "grader.h"
using namespace std;
// vector<int> returns;
// int ind=0;
// int Guess(int val)
// {
// cout << val << endl;
// return returns[ind++];
// }
int HC(int N)
{
if(N==1) return 1;
int mid = (1+N)/2;
int no_one_cares=Guess(mid);
int mid_gue_bump=Guess(mid+1); // do we need to use intelligence from the previous guess???
int l,r;
if(mid_gue_bump==-1)
{
l=1;
r=mid;
}
else
{
l=mid+1;
r=N;
}
while(l<r)
{
// cout << l << " " << r << endl;
int cur_mid=(l+r)/2;
Guess(cur_mid);
int cur = Guess(cur_mid+1);
if(cur==-1)
{
r=cur_mid;
}
else
{
l=cur_mid+1;
}
}
return l;
// int g = Guess(1);
// int h = Guess(N);
// if (g == 0) return N/2;
// if (g < 0) return N/4;
// if (g > 0) return 3*N/4;
}
// int main()
// {
// returns={0,-1,-1,-1,-1,-1,-1,1};
// cout << "GUESS: " << HC(10) << endl;
// }
Compilation message (stderr)
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:30:6: warning: unused variable 'no_one_cares' [-Wunused-variable]
int no_one_cares=Guess(mid);
^~~~~~~~~~~~
# | 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... |