Submission #287340

#TimeUsernameProblemLanguageResultExecution timeMemory
287340kevleeBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
540 ms206460 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mod 1000000007 #define h1 7897897897897897 #define h2 7897466719774591 #define b1 98762051 #define b2 98765431 #define inf 1000000000 #define pi 3.1415926535897932384626 #define LMAX 9223372036854775807 #define ll long long #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vp vector<pii> #define SET(a, b) memset(a, b, sizeof(a)); #define all(x) (x).begin(), (x).end() #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define FORD(i, a, b) for (int i = (a); i >= (b); i--) ll l[10000005], r[10000005], ans; long long delivery(int n, int k, int L, int a[]) { FOR(i, 0, n - 1) { l[i] = min(L, 2 * a[i]); r[i] = min(L, 2 * (L - a[i])); if (i >= k) l[i] += l[i - k]; } for (int i = n - 1, j = 0; i >= 0; i--, j++) { if (j >= k) r[i] += r[i + k]; } ans = min(l[n-1], r[0]); FOR(i, 0, n-2) { ans = min(ans, l[i] + r[i + 1]); } 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...