제출 #1125981

#제출 시각아이디문제언어결과실행 시간메모리
1125981czauderna도로 폐쇄 (APIO21_roads)C++20
7 / 100
43 ms10952 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...