Submission #425845

#TimeUsernameProblemLanguageResultExecution timeMemory
425845OzyRoad Closures (APIO21_roads)C++17
5 / 100
137 ms13372 KiB
#include "roads.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define lli long long int #define debugsl(a) cout << #a << " = " << a << ", " #define debug(a) cout << #a << " = " << a << endl #define MAX 100000 #define des first #define peso second vector< pair<lli,lli> > hijos[MAX+2]; vector<lli> orden; std::vector <long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { vector<long long> res (N, 0); rep(i,0,N-2) { hijos[ U[i] ].push_back({V[i], W[i]}); hijos[ V[i] ].push_back({U[i], W[i]}); orden.push_back(W[i]); } sort(orden.begin(),orden.end()); lli pos = 0; repa(i,N-2,0) { res[i] = res[i+1]; res[i] += orden[pos]; pos++; } 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...