제출 #500829

#제출 시각아이디문제언어결과실행 시간메모리
500829beaconmcRice Hub (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
typedef long long ll; using namespace std; int besthub(int R,int L,int X[],ll B){ ll lo=0,hi=0,ans=1,curcost=0; while (hi<R){ if ((hi-lo)%2==0 && hi!=lo) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo]; else curcost += X[hi] - X[(hi-lo-1)/2 + lo]; if (curcost>B){ if ((hi-lo)%2==0) curcost += X[lo] -X[hi]; else curcost += X[lo] - X[hi]; lo ++; } else hi++; ans = max(ans, hi-lo); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:15:15: error: 'max' was not declared in this scope
   15 |         ans = max(ans, hi-lo);
      |               ^~~