Submission #621244

#TimeUsernameProblemLanguageResultExecution timeMemory
621244M_WBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long delivery(int N, int K, int L, int p[]) { for(int i = 0; i < N; i++){ if(i - K < 0) cw[i] = (p[i] * 1ll) << 1; else cw[i] = cw[i - K] + ((p[i] * 1ll) << 1); } for(int i = N - 1; i >= 0; i--){ if(i + K > N - 1) ccw[i] = ((L - p[i]) * 1ll) << 1; else ccw[i] = ccw[i + K] + (((L - p[i]) * 1ll) << 1); } long long ans = min(cw[N - 1], ccw[0]); for(int i = 0; i < N - 1; i++) ans = min(ans, cw[i] + ccw[i + 1]); for(int i = 0; i + K + 1 < N; i++) ans = min(ans, cw[i] + ccw[i + K + 1] + (L * 1ll)); if(K >= N) ans = min(ans, L * 1ll); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:7:17: error: 'cw' was not declared in this scope
    7 |   if(i - K < 0) cw[i] = (p[i] * 1ll) << 1;
      |                 ^~
boxes.cpp:8:8: error: 'cw' was not declared in this scope
    8 |   else cw[i] = cw[i - K] + ((p[i] * 1ll) << 1);
      |        ^~
boxes.cpp:12:21: error: 'ccw' was not declared in this scope
   12 |   if(i + K > N - 1) ccw[i] = ((L - p[i]) * 1ll) << 1;
      |                     ^~~
boxes.cpp:13:8: error: 'ccw' was not declared in this scope
   13 |   else ccw[i] = ccw[i + K] + (((L - p[i]) * 1ll) << 1);
      |        ^~~
boxes.cpp:16:22: error: 'cw' was not declared in this scope
   16 |  long long ans = min(cw[N - 1], ccw[0]);
      |                      ^~
boxes.cpp:16:33: error: 'ccw' was not declared in this scope
   16 |  long long ans = min(cw[N - 1], ccw[0]);
      |                                 ^~~