#include "roads.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
const int N = 1e5+3;
vector<int> grf[N];
ll Br[N], Nb[N];
std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
for(int i=0; i<N-1; i++) grf[U[i]].pb(V[i]), grf[V[i]].pb(U[i]);
ll sm=0;
for(int i=N-2; i>=0; i--){
Br[i]=Nb[i+1];
Nb[i]=min(Br[i+1], Nb[i+1])+W[i];
sm+=W[i];
}
vector<ll> out; out.pb(sm); out.pb(min(Nb[0], Br[0]));
for(int i=2; i<N; i++) out.pb(0);
return out;
}
# | 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... |