Submission #231091

# Submission time Handle Problem Language Result Execution time Memory
231091 2020-05-12T16:41:42 Z muhammad_hokimiyon Hotter Colder (IOI10_hottercolder) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

int HC(int nn)
{
    int l = 1 , r = nn;
    if( nn == 2 ){
        int x = Guess(1);
        int y = Guess(2);
        if( y == -1 )return 1;
        return 2;
    }
    while( l < r ){
        int m = (l + r) / 2;
        int y2 = Guess( m );
        if( y2 == -1 || (y2 == 0 && (l > 1 || r < n)) ){
            r = m;
            continue;
        }
        int y1 = Guess( m + 1 );
        if( y1 == 1 )l = m + 1;
        else r = m;
    }
    return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:10:13: warning: unused variable 'x' [-Wunused-variable]
         int x = Guess(1);
             ^
hottercolder.cpp:18:51: error: 'n' was not declared in this scope
         if( y2 == -1 || (y2 == 0 && (l > 1 || r < n)) ){
                                                   ^