Submission #717305

#TimeUsernameProblemLanguageResultExecution timeMemory
717305tigarBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms340 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll dpcw[10000010], dpccw[10000010], pos[10000010]; ll delivery(int N, int K, int L, int* positions) { sort(positions, positions+N); for(int i=0; i<K; i++)dpccw[i]=min(L, 2*positions[i]); for(int i=K; i<N; i++)dpccw[i]=dpccw[i-K]+min(L, 2*positions[i]); for(int i=N-1; i>N-K; i--)dpcw[i]=min(N, (N-positions[i])*2); for(int i=N-K; i>=0; i--)dpcw[i]=dpcw[i+K]+min(N, (N-positions[i])*2); ll rezz=dpcw[0]; for(int i=0; i<N-1; i++)rezz=min(rezz, dpcw[i+1]+dpccw[i]); rezz=min(rezz, dpccw[N-1]); return rezz; } /*int main() { ll n, k, l; cin>>n>>k>>l; for(int i=0; i<n; i++)cin>>pos[i]; cout<<delivery(n, k, l, pos); return 0; }*/
#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...