# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648448 | Kirill22 | Game (eJOI20_game) | C++17 | 78 ms | 97588 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;
vector<vector<vector<vector<int>>>> dp;
vector<int> a, b;
int solve(int A, int B, int c, int d) {
if (A == (int) a.size() && B == (int) b.size() && c == 0 && d == 0) {
return 0;
}
vector<int> upda, updb;
if (A < a.size()) upda = {A};
if (B < b.size()) updb = {B};
if (dp[A][B][c][d] == (int) -2e9) {
for (auto i : upda) {
dp[A][B][c][d] = max(dp[A][B][c][d], -(a[i] - 4) - solve(A + 1, B, c, d + 1));
}
for (auto i : updb) {
auto tc = c, td = d;
int L = b[i] / 2, R = b[i] - L, res = 0;
if (L >= 2) {
tc++;
res += L - 2;
} else if (L) {
res++;
}
if (R >= 2) {
tc++;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |