Submission #444511

#TimeUsernameProblemLanguageResultExecution timeMemory
444511osmanallazovBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> #define ll long long long long delivery(int N, int K, int L, int p[]) { ll res=0; if(K==1){ for(int i=0;i<N;i++){ if(p[i]==0){ res+=0; } else if(p[i]<=L/2){ res+=(p[i]*2); } else{ res+=((L-p[i])*2); } } } else if(K==N){ ll mini=1000000001; ll maks=-1; for(int i=0;i<N;i++){ if(p[i]!=0){ mini=min(mini,p[i]); maks=max(maks,p[i]);} } if(mini<=L/2 && maks<=L/2){ res=maks*2; } else if(mini>L/2 && maks>L/2){ res=(L-mini)*2; } else{ res=L; } } return res; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:24:18: error: 'min' was not declared in this scope; did you mean 'std::min'?
   24 |             mini=min(mini,p[i]);
      |                  ^~~
      |                  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:25:18: error: 'max' was not declared in this scope; did you mean 'std::max'?
   25 |             maks=max(maks,p[i]);}
      |                  ^~~
      |                  std::max
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:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~