Submission #628351

# Submission time Handle Problem Language Result Execution time Memory
628351 2022-08-13T10:46:25 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=500,kq=500,val;
    last=500;
    val=Guess(500);
    while (l<r){
        int mid=l+r-last;
        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:5:5: error: 'last' was not declared in this scope
    5 |     last=500;
      |     ^~~~