Submission #628370

# Submission time Handle Problem Language Result Execution time Memory
628370 2022-08-13T10:59:20 Z abcvuitunggio Hotter Colder (IOI10_hottercolder) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
using namespace std;
int HC(int N){
    int cnt=1,l=1,r=N,kq=N,val;
    int last=N;
    val=Guess(N);
    while (l<r){
        int mid=l+r-last;
      	mid=max(mid,1);
      	mid=min(mid,N);
        val=Guess(mid);
        cnt++;
        if (val==0){
            kq=(mid+last)/2;
            break;
        }
        if (val==1){
            if (last<mid)
                l=(last+mid+1)/2;
            else{
                r=(last+mid-1)/2;
                kq=r;
            }
            last=mid;
            continue;
        }
        if (last<mid){
            r=(last+mid-1)/2;
            kq=r;
        }
        else
            l=(last+mid+1)/2;
        last=mid;
    }
    return kq;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:9:12: error: 'max' was not declared in this scope
    9 |        mid=max(mid,1);
      |            ^~~
hottercolder.cpp:10:12: error: 'min' was not declared in this scope; did you mean 'mid'?
   10 |        mid=min(mid,N);
      |            ^~~
      |            mid