# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
375687 | valerikk | Dango Maker (JOI18_dango_maker) | C++17 | 1886 ms | 18540 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 namespace std;
typedef long long ll;
typedef long double ld;
// R
// RG
// RGW
// GW
// W
const int INF = 1e9;
int solve(vector<int> d, vector<int> r) {
int n = d.size();
vector<vector<int>> dp(3, vector<int>(3, -INF));
dp[0][0] = 0;
for (int i = 0; i < n; ++i) {
vector<vector<int>> ndp(3, vector<int>(3, -INF));
for (int x = 0; x < 3; ++x) {
for (int y = 0; y < 3; ++y) {
if (dp[x][y] == -INF) continue;
for (int z = 0; z < 3; ++z) {
if (z == 1 && (x == 2 || y == 2 || !d[i])) continue;
if (z == 2 && !r[i]) continue;
ndp[y][z] = max(ndp[y][z], dp[x][y] + !!z);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |