# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899289 | LucaIlie | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 215 ms | 197012 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;
const int MAX_N = 5000;
const long long INF = 1e15;
int n;
int parent[MAX_N + 1], height[MAX_N + 1], cost[MAX_N + 1];
long long dp[MAX_N + 1][MAX_N + 1];
vector<int> children[MAX_N + 1];
map<int, int> mp;
void dfs( int u ) {
for ( int v: children[u] )
dfs( v );
dp[u][n] = INF;
// printf( "%d\n", u );
for ( int x = n - 1; x >= 0; x-- ) {
dp[u][x] = (height[u] == x ? 0 : cost[u]);
for ( int v: children[u] )
dp[u][x] += dp[v][x];
dp[u][x] = min( dp[u][x], dp[u][x + 1] );
// printf( "%d ", dp[u][x] );
}
//printf( "\n" );
}
int main() {
cin >> n;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |