Submission #402918

#TimeUsernameProblemLanguageResultExecution timeMemory
402918EJOI2019AndrewBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" long long mn(int a,int b) { if(a<b) return a; return b; } long long delivery(int N, int K,int L, int p[]) { if(K==N) { sort(p, p+N); int mid = L/2; int sum = 0; for(int i = 0; i < N; i++) { if(p[i] <= mid) { sum = p[i]*2; } else if(p[i] > mid) { sum+=((L-p[i])*2); break; } } return min(sum, L); } if(K==1) { long long ans = 0; for(int i = 0; i < N; ++i) ans+=mn(p[i],L-p[i])*2; return ans; } }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:15:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |         sort(p, p+N);
      |         ^~~~
      |         short
boxes.cpp:31:16: error: 'min' was not declared in this scope; did you mean 'mid'?
   31 |         return min(sum, L);
      |                ^~~
      |                mid