제출 #413861

#제출 시각아이디문제언어결과실행 시간메모리
413861Chaska선물상자 (IOI15_boxes)C++11
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> long long delivery(int N, int K, int L, int p[]) { long long ans = 0; ans = min(p[N-1]+min(p[N-1],L-p[N-1]),p[0]+min(p[0],L-p[0])); return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:5:24: error: 'min' was not declared in this scope; did you mean 'std::min'?
    5 |       ans = min(p[N-1]+min(p[N-1],L-p[N-1]),p[0]+min(p[0],L-p[0]));
      |                        ^~~
      |                        std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/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:5:13: error: 'min' was not declared in this scope; did you mean 'std::min'?
    5 |       ans = min(p[N-1]+min(p[N-1],L-p[N-1]),p[0]+min(p[0],L-p[0]));
      |             ^~~
      |             std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/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:3:31: warning: unused parameter 'K' [-Wunused-parameter]
    3 | long long delivery(int N, int K, int L, int p[]) {
      |                           ~~~~^