Submission #976544

# Submission time Handle Problem Language Result Execution time Memory
976544 2024-05-06T17:03:38 Z LaviniaTornaghi Hotter Colder (IOI10_hottercolder) C++14
25 / 100
446 ms 8236 KB
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"

int n;

int rec(int l, int r, bool isl){ //l'ultima query e' stata fatta a sx -> quella dopo su dx
   if(r-l==1){
      if(isl){
         if(Guess(r)==-1) return l;
         return r;
      }else{
         if(Guess(l)==-1) return r;
         return l;
      }
   }
   int g;
   if(isl) g=Guess(r);
   else g=Guess(l);
   if(g==0) return (l+r)/2;
   if(isl){
      if(g==1){
         return rec((l+r)/2,r,0);
      }
      else{
         Guess(l);
         return rec(l,min(n,(l+r)/2),1);
      }
   }else{
      if(g==-1){
         Guess(r);
         return rec((l+r)/2,r,0);
      }
      else {
         return rec(l,min(n,(l+r)/2),1);
      }
   }
}

int HC(int N){
   n=N;
   Guess(1);
   return rec(1,N,1);
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 6768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 446 ms 8236 KB Output isn't correct - alpha = 0.000000000000
2 Halted 0 ms 0 KB -