Submission #780089

#TimeUsernameProblemLanguageResultExecution timeMemory
780089vjudge1Boxes with souvenirs (IOI15_boxes)C++17
50 / 100
2025 ms21680 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define pii pair<long long, long long> #define st first #define nd second #define sp " " #define endl "\n" #define ll long long const ll INF = 2e18 + 7; long long delivery(int N, int K, int L, int p[]) { int n = N, k = K, l = L; sort(p, p + n); vector<ll> dp(n + 5, INF); dp[n] = 0; for (int i = n - 1; i >= 0; i--){ for (int j = i; j < min(i + k, n); j++){ ll c = 0; if (p[j] <= L / 2) c = 2 * p[j]; else if (p[i] >= l / 2) c = 2 * (L - p[i]); else c = L; dp[i] = min(dp[i], dp[j + 1] + c); } } return dp[0]; }
#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...