# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
310966 | 2020-10-08T22:20:38 Z | LucaDantas | Hotter Colder (IOI10_hottercolder) | C++17 | 393 ms | 17400 KB |
#include "grader.h" #include<cassert> #include<cstdio> int guess(int a, int b) { Guess(a); return Guess(b); } int HC(int n){ int l = 1, r = n; int cnt = 0; while(r - l > 3) { int ans = guess(l, r); if(!ans) {assert(cnt < 18); return (l+r) >> 1;} if(ans == 1) l = (l+r+1) >> 1; else r = (l+r-1) >> 1; cnt += 2; } assert(cnt <= 14); // printf("%d\n", cnt); if(r == l) return l; if(r-l == 1) return guess(l, r)==1?r:l; if(r - l == 2) { int ans = guess(l, r); return ans==1?r:ans==0?l+1:l; } if(r - l == 3) { int ans = guess(l, r-1); if(ans == 0) return l+1; if(ans == -1) return l; if(Guess(r) == 1) return r; // printf("%d\n", cnt+3); return r-1; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 1280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1280 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 393 ms | 17400 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |