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;
using ll = long long;
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);
for(int i=2;i<n;i++) ans[i] = 0;
long long even = 0, odd = 0;
for(int i=0;i<n;i++) {
if(i%2) odd += W[i];
else even += W[i];
}
ans[1] = min(even, odd);
ans[0] = even+odd;
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... |