제출 #594617

#제출 시각아이디문제언어결과실행 시간메모리
594617Vanilla선물상자 (IOI15_boxes)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long int64; const int maxn = 1e7 + 2; int64 l[maxn], r[maxn]; long long delivery(int n, int k, int m, int p[]) { for (int i = 0; i < n; i++){ l[i] = (i ? l[i-1]: 0) + p[i]; } for (int i = n - 1; i >= 0; i--){ r[i] = r[i + 1] + m - p[i]; } int64 rs = 1e18; for (int i = 0; i < n; i++){ rs = min(rs, l[i] + 2 * ((i + k - 1) / k) + r[i + 1] + 2 * ((n - i - 1 + k - 1) / k)); } return rs; }
#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...