답안 #234694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234694 2020-05-25T08:01:36 Z Nodir_Bobiev Hotter Colder (IOI10_hottercolder) C++14
컴파일 오류
0 ms 0 KB
#include "grader.h"

int solve( int l, int r, int prevRequest){
   if( l == r ) return l;
   if( r - l == 1 ){
      Guess(l);
      int res2 = Guess(r);
      if( res2 == 1)
         return r;
      return l;
   }
   int m = (l+r)>>1;
   if( m == prevRequest ) m --;
   int res1 = Guess(m);
   if( res1 == 0 ){
      return (m+prevRequest)/2;
   }
   if( res1 == 1 ){
      if( prevRequest < m )
         return solve(max(l,(m+prevRequest)/2+1), r, m);
      else
         return solve(l, min(r, (m+prevRequest-1)/2), m);
   }
   
   if( prevRequest < m ){
      return solve(l, (prevRequest+m-1)/2, m);
   }else{
      return solve((prevRequest+m)/2+1, r, m);
   }
   
}
int HC(int N){
   Guess(N);
   return solve(1, N, N);   
}

Compilation message

hottercolder.cpp: In function 'int solve(int, int, int)':
hottercolder.cpp:20:23: error: 'max' was not declared in this scope
          return solve(max(l,(m+prevRequest)/2+1), r, m);
                       ^~~
hottercolder.cpp:22:26: error: 'min' was not declared in this scope
          return solve(l, min(r, (m+prevRequest-1)/2), m);
                          ^~~