Submission #1123284

#TimeUsernameProblemLanguageResultExecution timeMemory
1123284heeyBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#define all(x) (x).begin(), (x).end() #define mod 1'000'000'007 #define inf 1'000'000'000'000'00 #define pb push_back #define vvi vector<vi> #define fst ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; #include "boxes.h" long long delivery(int n, int k, int L, int a[]){ long long res = LONG_MAX; vector<long long> dpc(n+1, 0), dpcc(n+1, 0); for(int i = 1; i <= n; i++){ if(i > k) dpc[i] = dpc[i-k]; dpc[i] += min(L, 2*a[i-1]); } for(int i = n-1; i >= 0; i--){ if(i < n-k) dpcc[i] = dpcc[i+k]; dpcc[i] += min(L, 2*(L - a[i])); } for(int i = 0; i <= n; i++){ res = min(res, dpc[i] + dpcc[i]); } return res; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:12:25: error: 'LONG_MAX' was not declared in this scope
   12 |         long long res = LONG_MAX;
      |                         ^~~~~~~~
boxes.cpp:9:1: note: 'LONG_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    8 | #include "boxes.h"
  +++ |+#include <climits>
    9 | 
boxes.cpp:13:9: error: 'vector' was not declared in this scope
   13 |         vector<long long> dpc(n+1, 0), dpcc(n+1, 0);
      |         ^~~~~~
boxes.cpp:9:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    8 | #include "boxes.h"
  +++ |+#include <vector>
    9 | 
boxes.cpp:13:16: error: expected primary-expression before 'long'
   13 |         vector<long long> dpc(n+1, 0), dpcc(n+1, 0);
      |                ^~~~
boxes.cpp:15:27: error: 'dpc' was not declared in this scope
   15 |                 if(i > k) dpc[i] = dpc[i-k];
      |                           ^~~
boxes.cpp:16:17: error: 'dpc' was not declared in this scope
   16 |                 dpc[i] += min(L, 2*a[i-1]);
      |                 ^~~
boxes.cpp:16:27: error: 'min' was not declared in this scope
   16 |                 dpc[i] += min(L, 2*a[i-1]);
      |                           ^~~
boxes.cpp:20:29: error: 'dpcc' was not declared in this scope
   20 |                 if(i < n-k) dpcc[i] = dpcc[i+k];
      |                             ^~~~
boxes.cpp:21:17: error: 'dpcc' was not declared in this scope
   21 |                 dpcc[i] += min(L, 2*(L - a[i]));
      |                 ^~~~
boxes.cpp:21:28: error: 'min' was not declared in this scope
   21 |                 dpcc[i] += min(L, 2*(L - a[i]));
      |                            ^~~
boxes.cpp:26:32: error: 'dpc' was not declared in this scope
   26 |                 res = min(res, dpc[i] + dpcc[i]);
      |                                ^~~
boxes.cpp:26:41: error: 'dpcc' was not declared in this scope
   26 |                 res = min(res, dpc[i] + dpcc[i]);
      |                                         ^~~~
boxes.cpp:26:23: error: 'min' was not declared in this scope
   26 |                 res = min(res, dpc[i] + dpcc[i]);
      |                       ^~~