Submission #1331060

#TimeUsernameProblemLanguageResultExecution timeMemory
1331060hectormedranoHotter Colder (IOI10_hottercolder)C++20
0 / 100
420 ms8296 KiB
#include <bits/stdc++.h>
#include "grader.h"
//#include "hottercolder.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int HC(int N){
   ll L, R;
   L = 0;
   R = N+1;
   while(R - L > 2){
    ll M = (L+R)/2;
    Guess(M-1);
    ll w = Guess(M+1);
    if(w == 0){return M;}
    if(w == 1){L = M;}
    if(w == -1){R = M;}
   }
   if(L==0){
    Guess(L+1);
    ll w = Guess(L+2);
    if(w == 1){return L+2;}
    if(w == -1){return L+1;}
   }
   if(R==N+1){
    Guess(R-1);
    ll w = Guess(R-2);
    if(w == 1){return R-2;}
    if(w == -1){return R-1;}
   }
   Guess(L);
   ll w = Guess(R);
   if(w == 0){return L+1;}
   if(w == 1){return R;}
   if(w == -1){return L;}
}

Compilation message (stderr)

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...