Submission #772138

# Submission time Handle Problem Language Result Execution time Memory
772138 2023-07-03T16:58:54 Z Abkonl Hotter Colder (IOI10_hottercolder) C++17
0 / 100
10000 ms 8104 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;

int Guess (int x);

int HC(int N)
{
   int low = 1;
   int high = N;
   int guess = high; // Primeiro palpite é N
   int previous_guess = 0;

   while (low < high)
   {
      int response = Guess(guess);
      if (response == 1)
      {
         if (previous_guess > guess)
            high = (guess + high) / 2;

         if (previous_guess < guess)
            low = (guess + low) / 2;
      }
      else if (response == -1)
      {
         if (previous_guess > guess)
            low = (guess + low) / 2;

         if (previous_guess < guess)
            high = (guess + high) / 2;
      }
      previous_guess = guess;
      if (response == 0 && guess == previous_guess) // Casos especiais
         guess = guess + 1;

      if (response != 0) // Padrão
         guess = (low + high) / 2;
   }
   return low;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10023 ms 1296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10017 ms 1236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10051 ms 1236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10040 ms 8104 KB Time limit exceeded