Submission #231496

#TimeUsernameProblemLanguageResultExecution timeMemory
231496muhammad_hokimiyonHotter Colder (IOI10_hottercolder)C++14
78 / 100
732 ms8184 KiB
#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)

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:30:17: warning: unused variable 'x1' [-Wunused-variable]
             int x1 = Guess(1);
                 ^~
hottercolder.cpp:21:9: warning: unused variable 'Q' [-Wunused-variable]
     int Q = 0;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...