Submission #41037

#TimeUsernameProblemLanguageResultExecution timeMemory
41037969Hotter Colder (IOI10_hottercolder)C++14
0 / 100
861 ms55232 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 = hi; break; } if (h == SAME) { break; } g = h; if (h == HOTTER) { lo = mid + 1; } else if (h == COLDER) { hi = mid - 1; } Guess(lo); h = Guess(hi); 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);
      ^
hottercolder.cpp:12:6: warning: unused variable 'before' [-Wunused-variable]
  int before = hi;
      ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...