Submission #562886

#TimeUsernameProblemLanguageResultExecution timeMemory
562886saultapiaHotter Colder (IOI10_hottercolder)C++17
0 / 100
10098 ms24300 KiB
#include "grader.h"

int HC(int N){
   int low = 1;
   int high = N;

   if(N == 1) return 1;
   int ans = Guess(N / 2);
   int l, r, mid, lftans, rghtans;
   while(low <= high)
   {
      mid = (low + high) >> 1;
      l = (low + mid) >> 1;
      r = (mid + high) >> 1;
      lftans = Guess(l);
      rghtans = Guess(r);
      if(l == r)
      {
         return l;
      }
      if(lftans == -1)
      {
         low = l + 1;
      }
      if(rghtans == -1)
      {
         high = r - 1;
      }
      if(lftans == 1)
      {
         high = mid - 1;
      }
      if(rghtans == 1)
      {
         low = mid + 1;
      }
   }
   
}

Compilation message (stderr)

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:8:8: warning: unused variable 'ans' [-Wunused-variable]
    8 |    int ans = Guess(N / 2);
      |        ^~~
hottercolder.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...