Submission #567196

#TimeUsernameProblemLanguageResultExecution timeMemory
567196MazaalaiRoad Closures (APIO21_roads)C++17
5 / 100
49 ms9932 KiB
#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 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...