Submission #1082745

#TimeUsernameProblemLanguageResultExecution timeMemory
1082745blackslexRoad Closures (APIO21_roads)C++17
5 / 100
39 ms5976 KiB
#include "roads.h" #include <vector> #include<bits/stdc++.h> using namespace std; using ll = long long; std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { int n = N, m = U.size(); ll res = 0; priority_queue<int> pq; for (int i = 0; i < m; i++) res += W[i], pq.emplace(W[i]); vector<ll> ans; for (int i = 0; i < n; i++) { ans.emplace_back(res); if (!pq.empty()) res -= pq.top(), pq.pop(); } 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...