Submission #979910

#TimeUsernameProblemLanguageResultExecution timeMemory
979910nninRoad Closures (APIO21_roads)C++14
0 / 100
29 ms6768 KiB
#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 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...