Submission #26715

# Submission time Handle Problem Language Result Execution time Memory
26715 2017-07-05T10:11:55 Z baactree Hotter Colder (IOI10_hottercolder) C++14
Compilation error
0 ms 0 KB
#include "grader.h"

int HC(int N){
    int le,ri;
    le=1;
    ri=N;
    while(true){
        int a=(le*2+ri)/3;
        int b=(le+ri*2)/3;
        int g=Guess(a);
        int p=Guess(b);
        if(p==0){
            return (a+b)/2;
        }
        else if(p>0){
            le=(a+b)/2+1;
        }
        else{
            if((a+b)%2==0)
                ri=(k*3)/2-1;
            else
                ri=(k*3)/2;
        }
        if(le==ri)
            return le;
    }
    return 0;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:20:21: error: 'k' was not declared in this scope
                 ri=(k*3)/2-1;
                     ^
hottercolder.cpp:22:21: error: 'k' was not declared in this scope
                 ri=(k*3)/2;
                     ^
hottercolder.cpp:10:13: warning: unused variable 'g' [-Wunused-variable]
         int g=Guess(a);
             ^