Submission #59251

#TimeUsernameProblemLanguageResultExecution timeMemory
59251aquablitz11Hotter Colder (IOI10_hottercolder)C++14
78 / 100
836 ms8184 KiB
#include <assert.h> #include "grader.h" int HC(int n) { int l = 1; int r = n; int p = 0; while (l < r) { if (p != l && p != r) { Guess(l); p = l; } int z = r-l+1; int m = (l+r)/2; if (p == l) { int res = Guess(r); p = r; if (z%2 == 0) { if (res == 1) l = m+1; else if (res == -1) r = m; else assert(false); } else { if (res == 1) l = m+1; else if (res == -1) r = m-1; else l = r = m; } } else { int res = Guess(l); p = l; if (z%2 == 0) { if (res == 1) r = m; else if (res == -1) l = m+1; else assert(false); } else { if (res == 1) r = m-1; else if (res == -1) l = m+1; else l = r = m; } } } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...