Submission #43084

#TimeUsernameProblemLanguageResultExecution timeMemory
43084leejseoBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int N, K, L; long long CW[10000005]; long long CCW[10000005]; int P[10000005]; long long delivery (int n, int k, int l, int p[]){ N = n, K = k, L = l; for (int i=1; i<=N: i++) P[i] = p[i-1]; for (int i=1; i<=N; i++){ int j = max(i-K, 0); CW[i] = CW[j] + P[i] + min(L-P[i], P[i]); } for (int i=N; i>0; i--){ int j = min(N+1, i+K); CCW[i] = CCW[j] + L - P[i] + min(L - P[i], P[i]); } long long ans = 9e18; for (int i=1; i<=N; i++){ ans = min(ans, CW[i] + CCW[i+1]) } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:9:20: error: found ':' in nested-name-specifier, expected '::'
  for (int i=1; i<=N: i++) P[i] = p[i-1];
                    ^
boxes.cpp:9:19: error: 'N' is not a class, namespace, or enumeration
  for (int i=1; i<=N: i++) P[i] = p[i-1];
                   ^
boxes.cpp:9:25: error: expected ';' before ')' token
  for (int i=1; i<=N: i++) P[i] = p[i-1];
                         ^
boxes.cpp:21:2: error: expected ';' before '}' token
  }
  ^