# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920415 | vjudge1 | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++17 | 268 ms | 134992 KiB |
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>
using i64 = long long;
#define all(x) (x).begin(), (x).end()
const int N = 400 + 5;
const int INF = 1E9;
int n, pre[3][N][3];
std::vector<int> idxs[3];
std::vector<std::vector<std::vector<std::vector<int>>>> dp;
std::vector<int>::iterator it;
int f(int a, int b, int c, int last) {
if(dp[a][b][c][last] != -1) {
return dp[a][b][c][last];
} else if(a + b + c == n) {
return 0;
}
int res = INF;
if(a != idxs[0].size() && last != 0) {
int cost = 0;
cost += std::max(0, pre[0][a][1] - b);
cost += std::max(0, pre[0][a][2] - c);
res = std::min(res, f(a + 1, b, c, 0) + cost);
}
if(b != idxs[1].size() && last != 1) {
Compilation message (stderr)
# | 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... |