Submission #1116579

#TimeUsernameProblemLanguageResultExecution timeMemory
1116579PagodePaivaRoad Closures (APIO21_roads)C++17
5 / 100
40 ms5964 KiB
#include<bits/stdc++.h> #include "roads.h" #include <vector> using namespace std; std::vector<long long> minimum_closure_costs(int n, std::vector<int> U, std::vector<int> V, std::vector<int> W) { long long res = 0; vector <int> v; for(int i = 0;i < n-1;i++){ v.push_back(W[i]); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); vector <long long> ans; ans.push_back(0); for(int k = n-2;k >= 0;k--){ res += v.back(); v.pop_back(); ans.push_back(res); } 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...