Submission #317310

# Submission time Handle Problem Language Result Execution time Memory
317310 2020-10-29T11:22:08 Z seedkin Hotter Colder (IOI10_hottercolder) C
50 / 100
733 ms 8312 KB
#include "grader.h"

int HC(int N){

   int low = 1;
   int high = N;   
   int flag = 1;
   int g = Guess(low);
   while ( high - low > 2 ) {
      if(flag) g = Guess(high);
      else g = Guess(low);

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

   if(flag) g = Guess(high);
   else g = Guess(low);

   if(g == 1 && flag) {
      return high;
   } else if( g == -1 && flag) {
      return low;
   } else if (g == 1 && flag == 0) {
      return low;
   } else if (g == -1 && flag == 0) {
      return high;
   } else {
      return (low + high) /2;
   }

}
# Verdict Execution time Memory Grader output
1 Correct 23 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 23 ms 1280 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 733 ms 8312 KB Output isn't correct - alpha = 0.000000000000