Submission #608484

#TimeUsernameProblemLanguageResultExecution timeMemory
608484loctildoreBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms340 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; // trans rights #define ll long long #define f first #define s second #define endl '\n' #define all(x) begin(x), end(x) ll n,k,l; ll dp1[10000069],dp2[10000069]; long long delivery(int N, int K, int Li, int p[]) { n=N;k=K;l=Li; for (ll i = 0; i < n; i++) { if (i<k) { dp1[i]=p[i]; } else { dp1[i]=dp1[i-k]+p[i]; } } for (ll i = n-1; ~i; i--) { if (n<=k+i) { dp2[i]=l-p[i]; } else { dp2[i]=l-p[i]+dp2[i+k]; } } ll ans=dp2[0]; for (ll i = 0; i < n; i++) { ans=min(ans,dp1[i]+dp2[i+1]); } return ans*2; }
#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...