Submission #282744

#TimeUsernameProblemLanguageResultExecution timeMemory
282744JoseCopasBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include "boxes.h" /* #include "bits/stdc++.h" using namespace std; */ long long delivery(int N, int K, int L, int p[]) { int c=0; if(K==1) { sort(p, p+N); for(int i=0;i<N;i++) { //cout<<p[i]<<" "; c+=min(L-p[i], p[i]); } } cout<<c<<"\n"; return 0; } /* int main() { int n,k,l; cin>>n>>k>>l; int v[n]; for(int i=0;i<n;i++)cin>>v[i]; delivery(n,k,l,v); } */

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |         sort(p, p+N);
      |         ^~~~
      |         short
boxes.cpp:16:16: error: 'min' was not declared in this scope
   16 |             c+=min(L-p[i], p[i]);
      |                ^~~
boxes.cpp:19:5: error: 'cout' was not declared in this scope
   19 |     cout<<c<<"\n";
      |     ^~~~