제출 #678495

#제출 시각아이디문제언어결과실행 시간메모리
678495penguin133선물상자 (IOI15_boxes)C++17
100 / 100
515 ms270576 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif long long P[10000005], S[10000005]; long long delivery(int N, int K, int L, int p[]) { for(int i=1;i<=K;i++)P[i] = p[i-1] * 2; for(int i=K+1;i<=N;i++)P[i] = P[i-K] + p[i-1] * 2; for(int i=N;i>=N-K+1;i--)S[i] = (L - p[i-1])*2; for(int i=N-K;i>=1;i--)S[i] = S[i+K] + (L - p[i-1]) * 2; S[N+1] = 0; long long ans = 1e18; for(int i=0;i<=N;i++)ans = min(ans, P[i] + S[i+1]); for(int i=K;i<=N;i++){ ans = min(ans, P[i-K] + S[i+1] + 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...