# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231496 | muhammad_hokimiyon | Hotter Colder (IOI10_hottercolder) | C++14 | 732 ms | 8184 KiB |
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<bits/stdc++.h>
#include "grader.h"
using namespace std;
/*int ls;
int num = 20;
int Guess( int x )
{
int x1 = abs(num - x);
int x2 = abs(num - ls);
ls = x;
if( x1 < x2 )return 1;
if( x1 > x2 )return -1;
return 0;
}*/
int HC(int nn)
{
int Q = 0;
int ls1 = 0;
int ls2 = 0;
int l = 1 , r = nn;
while( l < r ){
ls1 = ls2;
//cout << "\n";
int m = (l + r) / 2;
if( l == 1 && r == 2 ){
int x1 = Guess(1);
int x2 = Guess(2);
if( x2 == 1 )return 2;
return 1;
}
//cout << l << " " << r << " " << m - 1 << " ";
int x1 = Guess(m - 1);
ls2 = m - 1;
if( x1 == -1 && m < ls1 ){
l = m + 1;
continue;
}
if( x1 == -1 && m - 1 > ls1 ){
r = m - 1;
continue;
}
//cout << m + 1;
ls2 = m + 1;
int x2 = Guess(m + 1);
if( x2 == 0 ){
return m;
}
if( x2 == 1 )l = m + 1;
else r = m - 1;
}
return l;
}
/*int main()
{
int n;
cin >> n;
cout << "\n" << HC(n);
}*/
Compilation message (stderr)
# | 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... |