# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
626959 | Glory | Road Closures (APIO21_roads) | C++17 | 0 ms | 0 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<iostream>
#define int long long
using namespace std;
int64[] minimum_closure_costs(int N, int[] U, int[] V, int[] W){
int ans[N+5];
int res = 0;
for(int i=1; i<=N; i++){
res+= W[i];
}
sort(W+1,W+1+N,greater<int>());
ans[0]=res;
for(int i=1; i<=N; i++){
res-=W[i-1];
ans[i]=res;
}
return ans;
}