Submission #239454

# Submission time Handle Problem Language Result Execution time Memory
239454 2020-06-15T16:28:50 Z DavidDamian Hotter Colder (IOI10_hottercolder) C++11
Compilation error
0 ms 0 KB
#include "grader.h"
///Subtask 2
///Binary Search
int HC(int N){
    int L=2,R=N;
    int ans=N;
    while(L<=R){
        if(L==R)
            return L
        int mid=(L+R)/2;
        int previous=Guess(mid-1);
        int act=Guess(mid);
        if(act==-1){
            ans=mid-1;
            R=mid-1;
        }
        else{
            L=mid+1;
        }
    }
    return ans;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:10:9: error: expected ';' before 'int'
         int mid=(L+R)/2;
         ^~~
hottercolder.cpp:11:13: warning: unused variable 'previous' [-Wunused-variable]
         int previous=Guess(mid-1);
             ^~~~~~~~