Submission #597540

# Submission time Handle Problem Language Result Execution time Memory
597540 2022-07-16T09:32:38 Z sff_user Hotter Colder (IOI10_hottercolder) C++17
25 / 100
606 ms 13904 KB
#include "grader.h"
#include <bits/stdc++.h>


#define ll long long
#define vi vector<int>
#define pb push_back

using namespace std;

int HC(int N){
   ll l = 1,r = N;
   int G = Guess(l);
   ll last = 2;
   while(l<=r){
      int K = Guess(last==1?l:r);
      if(last == 2){
         if(K==1){
            l = (l+r)/2+1;
            G = Guess(r);
            last = 1;
         }
         if(K==-1){
            r = (l+r)/2;
            G = Guess(l);
         }
         if(K==0){
            return (l+r)/2;
         }
      }
      else{
         if(K==1){
            r = (l+r)/2;
            G = Guess(l);
            last = 2;
         }
         if(K==-1){
            l = (l+r)/2+1;
            G = Guess(r);
         }
         if(K==0){
            return (l+r)/2;
         }
      }
   }
   return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:13:8: warning: variable 'G' set but not used [-Wunused-but-set-variable]
   13 |    int G = Guess(l);
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 606 ms 13904 KB Output isn't correct - alpha = 0.000000000000