Submission #317293

# Submission time Handle Problem Language Result Execution time Memory
317293 2020-10-29T10:38:06 Z seedkin Hotter Colder (IOI10_hottercolder) C
0 / 100
10000 ms 116728 KB
#include "grader.h"

int HC(int N){

   int low = 1;
   int high = N;   
   int g;
   int h;
   while ( high - low <= 1 ) {
      g = Guess(low);
      h = Guess(high);

      if(h == 1) {
         low = (low + high) / 2;
      } else if (h == -1) {
         high = (low + high) / 2;
      } else {
         return (low + high) / 2;
      }
   }
   g = Guess(low);
   h = Guess(high);

   if(h == 1) {
      return high;
   } else if (h == -1) {
      return low;
   }

}

Compilation message

hottercolder.c: In function 'HC':
hottercolder.c:7:8: warning: variable 'g' set but not used [-Wunused-but-set-variable]
    7 |    int g;
      |        ^
hottercolder.c:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^
# Verdict Execution time Memory Grader output
1 Execution timed out 10011 ms 3968 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10095 ms 3840 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10013 ms 3968 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10015 ms 116728 KB Time limit exceeded