Submission #41035

#TimeUsernameProblemLanguageResultExecution timeMemory
41035969Hotter Colder (IOI10_hottercolder)C++14
0 / 100
10061 ms8056 KiB
#include "grader.h" #define HOTTER 1 #define COLDER -1 #define SAME 0 int HC(int N) { int lo = 1, hi = N; int g = Guess(lo); int h = Guess(hi); int mid = (lo + hi) / 2; int ans = (1 + N) / 2; int before = hi; while (1) { if (lo == hi) { ans = lo; break; } if (h == SAME) { break; } g = h; if (h == HOTTER) { if (before == hi) { lo = mid - 1; h = Guess(lo); before = lo; } else { hi = mid + 1; h = Guess(hi); before = hi; } } else if (h == COLDER) { if (before == hi) { hi = mid; h = Guess(hi); before = hi; } else { lo = mid; h = Guess(lo); before = lo; } } mid = (lo + hi) / 2; ans = mid; } return ans; }

Compilation message (stderr)

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:8:6: warning: variable 'g' set but not used [-Wunused-but-set-variable]
  int g = Guess(lo);
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...