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"
#define pb push_back
#define ALL(x) x.begin(),x.end()
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair <ll, ll>;
int n, m;
const int N = 1e5 + 5;
const int INF = 1e6;
vector <PII> paths[N];
vector<ll> minimum_closure_costs(int _n, vector<int> a, vector<int> b, vector<int> c) {
vector <ll> res;
m = a.size();
bool test1 = 1;
for (int i = 0; i < m; i++) {
if (a[i] > b[i]) swap(a[i], b[i]);
test1 &= (a[i] == 0);
}
if (test1) {
vector <int> edges;
for (int i = 0; i < m; i++) edges.pb(c[i]);
sort(ALL(edges));
ll sum = 0; res.pb(sum);
for (int i = 0; i < m; i++) {
sum += edges[i];
res.pb(sum);
}
reverse(ALL(res));
// for (auto el : res) cout <<
return res;
}
for (int i = 0; i < m; i++) {
paths[a[i]].pb({b[i], c[i]});
paths[a[i]].pb({b[i], c[i]});
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |