Submission #63322

#TimeUsernameProblemLanguageResultExecution timeMemory
63322hamzqq9Boxes with souvenirs (IOI15_boxes)C++14
10 / 100
2 ms376 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); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...