This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "cyberland.h"
// #include "stub.cpp"
using namespace std;
double solve(int n, int M, int K, int H, vector<int> X, vector<int> Y, vector<int> C, vector<int> a) {
vector<vector<double>> dp(H + 1, vector<double>(K + 1, LLONG_MAX));
dp[0][0] = 0;
for (int i = 1; i <= H; i++) {
for (int j = 0; j <= K; j++) {
if (dp[i - 1][j] == LLONG_MAX) continue;
dp[i][j] = min(dp[i][j], dp[i - 1][j] + C[i - 1]);
if (j != K && a[i] == 2) dp[i][j + 1] = min(dp[i][j + 1], (dp[i - 1][j] + C[i - 1]) / 2);
}
}
return *min_element(dp[H].begin(), dp[H].end());
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |