이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define nl "\n"
// subtask 1
const int maxn = 100005;
vector<pair<int, int> > adjlist[maxn];
vector<int64_t> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W){
for (int i=0; i<N-1; i++){
adjlist[U[i]].push_back(make_pair(W[i], V[i])); //weight, node
adjlist[V[i]].push_back(make_pair(W[i], U[i]));
}
for (auto i : adjlist) sort(i.begin(), i.end());
vector<int64_t> ans;
long long cursum = 0;
ans.push_back(cursum);
for (auto i : adjlist[0]){
cursum += i.first;
ans.push_back(cursum);
}
reverse(ans.begin(), ans.end());
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... |