제출 #1091537

#제출 시각아이디문제언어결과실행 시간메모리
1091537triplem5ds선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> long long cost[10000007]; long long delivery(int N, int K, int L, int p[]) { long long cur = 0; for(int i = 0, j = 0; i < N; i++) { if((j+=1) == K) j = 0; cost[i] = cur + p[i]; if(j == 0) cur += p[i]; } for(int i = N - 1, j = 0; i >= 0; i++) { if((j+=1) == K) j = 0; cost[i] = cur + L - p[i]; if(j == 0) cur += L - p[i]; } return *min_element(cost,cost+N); }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:18:13: error: 'min_element' was not declared in this scope; did you mean 'std::min_element'?
   18 |     return *min_element(cost,cost+N);
      |             ^~~~~~~~~~~
      |             std::min_element
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:5676:5: note: 'std::min_element' declared here
 5676 |     min_element(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~