Submission #134531

#TimeUsernameProblemLanguageResultExecution timeMemory
13453120160161simoneBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #define M 10000010 #define inf 0x3f3f3f int mi[M]; long long delivery(int N, int K, int L, int p[]) { for(int i=1;i<=N;i++){ mi[i]=min(abs(L-p[i]),abs(p[i]))*2; } sort(mi+1,mi+1+N); int ans=0,val=0,k=0; for(int i=1;i<=N;i++) { k++; val=max(mi[i],val); if(k==K) { ans+=val; val=0; k=0; } } ans+=val; return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:7:16: error: 'abs' was not declared in this scope
      mi[i]=min(abs(L-p[i]),abs(p[i]))*2;  
                ^~~
boxes.cpp:7:12: error: 'min' was not declared in this scope
      mi[i]=min(abs(L-p[i]),abs(p[i]))*2;  
            ^~~
boxes.cpp:7:12: note: suggested alternative: 'mi'
      mi[i]=min(abs(L-p[i]),abs(p[i]))*2;  
            ^~~
            mi
boxes.cpp:9:2: error: 'sort' was not declared in this scope
  sort(mi+1,mi+1+N);
  ^~~~
boxes.cpp:9:2: note: suggested alternative: 'short'
  sort(mi+1,mi+1+N);
  ^~~~
  short
boxes.cpp:14:7: error: 'max' was not declared in this scope
   val=max(mi[i],val);
       ^~~