# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98407 | MatheusLealV | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++17 | 143 ms | 99064 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>
#define N 402
using namespace std;
int n, v[N], pos[3][N], sz[3], inf = 2000000000, ans = 2000000000;
int dp[N][N][N][3], dij[N][N], diz[N][N], dji[N][N], dzi[N][N], djz[N][N], dzj[N][N];
int solve()
{
for(int i = 0; i <= sz[0]; i++)
{
for(int j = 0; j <= sz[1]; j++)
{
for(int z = 0; z <= sz[2]; z++)
{
for(int lst = 0; lst <= 2; lst ++)
{
if(!i and !j and !z)
{
dp[i][j][z][lst] = 0;
continue;
}
int A = inf, B = inf, C = inf, di = 0, dj = 0, dz = 0;
if(i > 0 and lst != 0) A = dp[i - 1][j][z][0]+ abs(i + j + z - pos[0][i] + di + dij[i][j + 1] + diz[i][z + 1]);
if(j > 0 and lst != 1) B = dp[i][j - 1][z][1] + abs(i + j + z - pos[1][j] + dj + dji[i + 1][j] + djz[z + 1][j]);
# | 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... |