Submission #413786

#TimeUsernameProblemLanguageResultExecution timeMemory
413786ak2006Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" 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:4:5: error: 'vl' was not declared in this scope
    4 |     vl pref(n),suf(n);
      |     ^~
boxes.cpp:5:22: error: 'n' was not declared in this scope
    5 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                      ^
boxes.cpp:5:28: error: 'pref' was not declared in this scope
    5 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                            ^~~~
boxes.cpp:5:69: error: 'k' was not declared in this scope
    5 |     for (int i = 0;i<n;i++)pref[i] = 1ll * 2 * 1ll * pos[i] + (i >= k ? pref[i - k] : 0);
      |                                                                     ^
boxes.cpp:6:18: error: 'n' was not declared in this scope
    6 |     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:6:33: error: 'suf' was not declared in this scope
    6 |     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:6:90: error: 'k' was not declared in this scope
    6 |     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:5: error: 'll' was not declared in this scope
    7 |     ll ans = min(pref[n - 1],suf[0]);
      |     ^~
boxes.cpp:8:22: error: 'n' was not declared in this scope
    8 |     for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]);
      |                      ^
boxes.cpp:8:32: error: 'ans' was not declared in this scope
    8 |     for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]);
      |                                ^~~
boxes.cpp:8:46: error: 'pref' was not declared in this scope
    8 |     for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]);
      |                                              ^~~~
boxes.cpp:8:56: error: 'suf' was not declared in this scope
    8 |     for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]);
      |                                                        ^~~
boxes.cpp:8:38: error: 'min' was not declared in this scope
    8 |     for (int i = 0;i<n - 1;i++)ans = min(ans,pref[i] + suf[i + 1]);
      |                                      ^~~
boxes.cpp:9:22: error: 'n' was not declared in this scope
    9 |     for (int i = 0;i<n;i++)
      |                      ^
boxes.cpp:10:9: error: 'ans' was not declared in this scope
   10 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |         ^~~
boxes.cpp:10:33: error: 'pref' was not declared in this scope
   10 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |                                 ^~~~
boxes.cpp:10:57: error: 'k' was not declared in this scope
   10 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |                                                         ^
boxes.cpp:10:65: error: 'suf' was not declared in this scope
   10 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |                                                                 ^~~
boxes.cpp:10:15: error: 'min' was not declared in this scope
   10 |         ans = min(ans,(i >= 1 ? pref[i - 1] : 0) + (i + k < n ? suf[i + k] : 0) + L);
      |               ^~~
boxes.cpp:11:12: error: 'ans' was not declared in this scope
   11 |     return ans;
      |            ^~~
boxes.cpp:3:24: warning: unused parameter 'N' [-Wunused-parameter]
    3 | long long delivery(int N, int K, int L, int pos[]) {
      |                    ~~~~^
boxes.cpp:3:31: warning: unused parameter 'K' [-Wunused-parameter]
    3 | long long delivery(int N, int K, int L, int pos[]) {
      |                           ~~~~^