Submission #778049

#TimeUsernameProblemLanguageResultExecution timeMemory
778049Jarif_RahmanBoxes with souvenirs (IOI15_boxes)C++17
50 / 100
2031 ms29508 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; const int K = 1e7; ll S[K]; ll delivery(int n, int k, int L, int P[]){ vector<ll> A(n+1), B(n+1); A[0] = 0, B[n] = 0; fill(S, S+k, 0); for(int i = 1; i <= n; i++){ S[i%k]+=2*P[i-1]; A[i] = S[i%k]; } fill(S, S+k, 0); for(int i = n-1; i >= 0; i--){ S[(n-i)%k]+=2*(L-P[i]); B[i] = S[(n-i)%k]; } ll ans = 1e18; for(int i = 0; i <= n; i++) for(int j = i; j <= n; j++){ ans = min(ans, A[i]+B[j]+ll((j-i+k-1)/k)*L); } return ans; }
#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...