Submission #119617

# Submission time Handle Problem Language Result Execution time Memory
119617 2019-06-21T12:57:14 Z win11905 Hotter Colder (IOI10_hottercolder) C++11
52 / 100
820 ms 8188 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std; 

int solve(int l, int r) {
   int sz = r-l+1;
   if(sz == 1) return l;
   if(sz == 2) {
      Guess(l);
      if(Guess(r) == 1) return r;
      else return l; 
   }
   if(sz == 3) {
      Guess(l);
      int val = Guess(r);
      if(val == 1) return r;
      if(val == 0) return r-1;
      return l;
   }
   int a = l + sz/4;
   int b = l + 3*sz/4;
   Guess(a);
   int val = Guess(b);
   int m = a + b >> 1;
   if(val == 0) return m;
   if(val == 1) return solve(m+1, r);
   return solve(l, m);
}

int HC(int N){
   return solve(1, N);
}

Compilation message

hottercolder.cpp: In function 'int solve(int, int)':
hottercolder.cpp:24:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    int m = a + b >> 1;
            ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 30 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 820 ms 8188 KB Output is partially correct - alpha = 0.066666666667