Submission #413787

#TimeUsernameProblemLanguageResultExecution timeMemory
413787ak2006Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #define ll long long #define vl vector<ll> long long delivery(int N, int K, int L, int pos[]) { vl pref(n),suf(n); for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0); for (int i = n - 1;i>=0;i--)suf[i] = 1ll * 2 * 1ll * (1ll * L - 1ll * pos[i]) + (i + k < n ? suf[i + k] : 0); ll ans = min(pref[n - 1],suf[0]); for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]); for (int i = 0;i<n;i++) ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:3:12: error: 'vector' was not declared in this scope
    3 | #define vl vector<ll>
      |            ^~~~~~
boxes.cpp:5:5: note: in expansion of macro 'vl'
    5 |     vl pref(n),suf(n);
      |     ^~
boxes.cpp:2:12: error: expected primary-expression before 'long'
    2 | #define ll long long
      |            ^~~~
boxes.cpp:3:19: note: in expansion of macro 'll'
    3 | #define vl vector<ll>
      |                   ^~
boxes.cpp:5:5: note: in expansion of macro 'vl'
    5 |     vl pref(n),suf(n);
      |     ^~
boxes.cpp:6:22: error: 'n' was not declared in this scope
    6 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                      ^
boxes.cpp:6:28: error: 'pref' was not declared in this scope
    6 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                            ^~~~
boxes.cpp:6:69: error: 'k' was not declared in this scope
    6 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                                                                     ^
boxes.cpp:7:18: error: 'n' was not declared in this scope
    7 |     for (int i = n - 1;i>=0;i--)suf[i] = 1ll * 2 * 1ll * (1ll * L - 1ll * pos[i]) + (i + k < n ? suf[i + k] : 0);
      |                  ^
boxes.cpp:7:33: error: 'suf' was not declared in this scope
    7 |     for (int i = n - 1;i>=0;i--)suf[i] = 1ll * 2 * 1ll * (1ll * L - 1ll * pos[i]) + (i + k < n ? suf[i + k] : 0);
      |                                 ^~~
boxes.cpp:7:90: error: 'k' was not declared in this scope
    7 |     for (int i = n - 1;i>=0;i--)suf[i] = 1ll * 2 * 1ll * (1ll * L - 1ll * pos[i]) + (i + k < n ? suf[i + k] : 0);
      |                                                                                          ^
boxes.cpp:8:18: error: 'pref' was not declared in this scope
    8 |     ll ans = min(pref[n - 1],suf[0]);
      |                  ^~~~
boxes.cpp:8:23: error: 'n' was not declared in this scope
    8 |     ll ans = min(pref[n - 1],suf[0]);
      |                       ^
boxes.cpp:8:30: error: 'suf' was not declared in this scope
    8 |     ll ans = min(pref[n - 1],suf[0]);
      |                              ^~~
boxes.cpp:8:14: error: 'min' was not declared in this scope
    8 |     ll ans = min(pref[n - 1],suf[0]);
      |              ^~~
boxes.cpp:11:57: error: 'k' was not declared in this scope
   11 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |                                                         ^
boxes.cpp:4:24: warning: unused parameter 'N' [-Wunused-parameter]
    4 | long long delivery(int N, int K, int L, int pos[]) {
      |                    ~~~~^
boxes.cpp:4:31: warning: unused parameter 'K' [-Wunused-parameter]
    4 | long long delivery(int N, int K, int L, int pos[]) {
      |                           ~~~~^