Submission #130916

#TimeUsernameProblemLanguageResultExecution timeMemory
130916antimirageBoxes with souvenirs (IOI15_boxes)C++14
50 / 100
2052 ms92120 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> #define fr first #define sc second #define mk make_pair #define pb push_back #define all(s) s.begin(), s.end() using namespace std; const int N = 1e7 + 5; long long dp[N]; long long delivery(int n, int k, int l, int pos[]) { memset(dp, 0x3f3f3f3f, sizeof(dp)); for (int i = 0; i < n; i++) { for (int j = 1; j <= min(k, i + 1); j++) { if (j > i) { dp[i] = min(dp[i], min( pos[i] * 2, min( l, (l - pos[0]) * 2 ) ) * 1ll ); } else { dp[i] = min(dp[i], dp[i - j] + min( pos[i] * 2, min( l, (l - pos[i - j + 1]) * 2 ) ) ); } } } return dp[n - 1]; }
#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...