#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, 1e18));
int l = H;
while (0 < l && a[l]) l--;
dp[l][0] = 0;
for (int i = l + 1; i <= H; i++) {
for (int j = 0; j <= K; j++) {
if (dp[i - 1][j] < 1e18) dp[i][j] = min(dp[i][j], dp[i - 1][j] + C[i - 1]);
if (j && a[i] == 2 && dp[i - 1][j - 1] < 1e18) dp[i][j] = min(dp[i][j], (dp[i - 1][j - 1] + C[i - 1]) / 2);
}
assert(dp[i][0] < 1e18);
}
double ans = 1e18;
for (auto i : dp[H]) {
if (ans < i) ans = i;
}
// assert(ans < 1e18);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
360 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
724 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
680 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
5972 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
724 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
696 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
960 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3092 ms |
1728528 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |