Submission #63321

#TimeUsernameProblemLanguageResultExecution timeMemory
63321hamzqq9Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; #define MAX 1000006 #define ll long long #define umin(x,y) x=min(x,y) #define umax(x,y) x=max(x,y) #define inf 100000000000000000 long long delivery(int N, int K, int L, int P[]) { ll ans1=0,ans2=0; int start=0; while(p[start]==0) start++; for(int i=start;i<N;i+=K) { int last=min(N-1,i+K-1); ll cost=min(1ll*L,min(2ll*P[last],2ll*(L-P[i]))); ans1+=cost; } for(int i=N-1;i>=start;i-=K) { int last=max(start,i-K+1); ll cost=min(1ll*L,min(2ll*P[i],2ll*(L-P[last]))); ans2+=cost; } return min(ans1,ans2); }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:16:8: error: 'p' was not declared in this scope
  while(p[start]==0) start++;
        ^