Submission #265181

# Submission time Handle Problem Language Result Execution time Memory
265181 2020-08-14T13:41:30 Z Toirov_Sadi Hotter Colder (IOI10_hottercolder) C++17
Compilation error
0 ms 0 KB
int rec(int l, int r, int last){
    if(l == r) return l;
    int m = (l + r) >> 1;
    if(m == last && m > l) m --;
    else if(m == last) m ++;

    int x = Guess(m);
    if(x == 0){
        return (m + last) / 2;
    }
    if(x == 1){
        if(m <= last) return rec(l, min((m + last - 1) / 2, r), m);
        else return rec(max(l, (m + last) / 2 + 1), r, m);
    }
    if(x == -1){
        if(m <= last) return rec(max(l, (m + last) / 2 + 1), r, m);
        else return rec(l, min((last + m - 1) / 2, r), m);
    }
}
int HC(int N){
    if(N == 1) return 1;
    Guess(N / 2);
    return rec(1, N, N / 2);
}

Compilation message

hottercolder.cpp: In function 'int rec(int, int, int)':
hottercolder.cpp:7:13: error: 'Guess' was not declared in this scope
    7 |     int x = Guess(m);
      |             ^~~~~
hottercolder.cpp:12:37: error: 'min' was not declared in this scope
   12 |         if(m <= last) return rec(l, min((m + last - 1) / 2, r), m);
      |                                     ^~~
hottercolder.cpp:13:25: error: 'max' was not declared in this scope
   13 |         else return rec(max(l, (m + last) / 2 + 1), r, m);
      |                         ^~~
hottercolder.cpp:16:34: error: 'max' was not declared in this scope
   16 |         if(m <= last) return rec(max(l, (m + last) / 2 + 1), r, m);
      |                                  ^~~
hottercolder.cpp:17:28: error: 'min' was not declared in this scope
   17 |         else return rec(l, min((last + m - 1) / 2, r), m);
      |                            ^~~
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:22:5: error: 'Guess' was not declared in this scope
   22 |     Guess(N / 2);
      |     ^~~~~