제출 #979908

#제출 시각아이디문제언어결과실행 시간메모리
979908nnin도로 폐쇄 (APIO21_roads)C++14
5 / 100
41 ms8760 KiB
#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 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...