제출 #446541

#제출 시각아이디문제언어결과실행 시간메모리
446541two_sides선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include <algorithm> long long delivery(int N, int K, int L, int P[]) { long long pref[N], suff[N]; for (int i = 0; i < N; i++) { pref[i] = min(L, P[i] * 2); if (i >= K) pref[i] += pref[i - K]; } for (int i = N - 1; i >= 0; i--) { suff[i] = min(L, (L - P[i]) * 2); if (i + K < N) suff[i] += suff[i + K]; } long long res = min(pref[N - 1], suff[0]); for (int i = 0; i + 1 < N; i++) res = min(res, pref[i] + suff[i + 1]); return res; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:6:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
    6 |         pref[i] = min(L, P[i] * 2);
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from boxes.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
boxes.cpp:10:19: error: 'min' was not declared in this scope; did you mean 'std::min'?
   10 |         suff[i] = min(L, (L - P[i]) * 2);
      |                   ^~~
      |                   std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from boxes.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
boxes.cpp:13:21: error: 'min' was not declared in this scope; did you mean 'std::min'?
   13 |     long long res = min(pref[N - 1], suff[0]);
      |                     ^~~
      |                     std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from boxes.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~