Submission #567189

#TimeUsernameProblemLanguageResultExecution timeMemory
567189MazaalaiRoad Closures (APIO21_roads)C++17
0 / 100
43 ms10640 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++) { 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; for (int i = 0; i < m; i++) { sum += edges[i]; res.pb(sum); } reverse(ALL(res)); 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...