Submission #318747

# Submission time Handle Problem Language Result Execution time Memory
318747 2020-11-03T05:40:12 Z seedkin Hotter Colder (IOI10_hottercolder) C
50 / 100
704 ms 24516 KB
#include "grader.h"
 
int HC(int N){
   if(N==1) return 1;
   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 + 1) / 2;
         flag = 0;
      } else if (g == -1 && flag) {
         high = (low + high - 1) / 2;
         g = Guess(low);
         flag = 1;
      } else if (g == 1 && flag == 0) {
         high = (low + high - 1) / 2;         
         flag = 1;
      } else if (g == -1 && flag == 0 ) {
         low = (low + high + 1) / 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 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1260 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 Partially correct 704 ms 24516 KB Output is partially correct - alpha = 0.120000000000