# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082744 | blackslex | Road Closures (APIO21_roads) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "roads.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MxN = 25e4 + 5;
ll dp[MxN][2];
vector<pii> v[MxN];
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;
}