제출 #983704

#제출 시각아이디문제언어결과실행 시간메모리
983704fcmalkcin도로 폐쇄 (APIO21_roads)C++17
0 / 100
32 ms8864 KiB
#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 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...