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 "roads.h"
#include<bits/stdc++.h>
#define pii pair<int,int>
#define f first
#define s second
using namespace std;
bool done[100005];
int ct[100005];
vector<int> deg[100005];
vector<long long> minimum_closure_costs(int n, vector<int> U, vector<int> V, vector<int> W) {
for(int i=0;i<n-1;i++) {
ct[U[i]]++;
ct[V[i]]++;
}
for(int i=0;i<n;i++) {
deg[ct[i]].push_back(i);
}
vector<long long> ans(n);
sort(W.begin(), W.end());
ans[n-1] = 0;
for(int i=n-2;i>=0;i--) {
ans[i] = ans[i+1]+W[n-2-i];
}
return ans;
}
# | 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... |