# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114453 | vladilius | Road Closures (APIO21_roads) | C++17 | 826 ms | 1048576 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;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second
vector<ll> minimum_closure_costs(int n, vector<int> U, vector<int> V, vector<int> W){
vector<pii> g[n + 1];
ll tot = 0;
for (int i = 0; i < n - 1; i++){
int u = U[i] + 1, v = V[i] + 1, w = W[i];
g[u].pb({v, w});
g[v].pb({u, w});
tot += w;
}
vector<vector<ll>> dp(n + 1, vector<ll>(n));
function<void(int, int)> dfs = [&](int v, int pr){
for (auto [i, w]: g[v]){
if (i == pr) continue;
dfs(i, v);
}
for (int k = 1; k < n; k++){
dp[v][k] = 0;
vector<ll> all;
for (auto [i, w]: g[v]){
if (i == pr) continue;
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |