Submission #569329

#TimeUsernameProblemLanguageResultExecution timeMemory
569329EdilRoad Closures (APIO21_roads)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vct vector <int> struct ed { ll x = 0; set <ll> y; }; bool cmp(ed a, ed b) { if(a.x == b.x) return a.y > b.y; return a.x > b.x; } vector <ll> minimum_closure_costs(ll n, vct u, vct v, vct w) { ll sm = 0; vector <ll> ans(n+1); vector <ed> tr(n+1); for(ll i = 0; i < (ll)w.size(); i++) { tr[u[i]].x++; tr[v[i]].x++; tr[u[i]].y.insert(w[i]); tr[v[i]].y.insert(w[i]); sm += w[i]; } ans[0] = sm; sort(tr.begin(), tr.end(), cmp); for(ll k = n; k > 0; k--) { sm = 0; for(ll i = 0; tr[i].x > k; i++) { tr[i].x--; sm += *tr[i].y.begin(); tr[i].y.erase(tr[i].y.begin()); } ans[k] = sm; } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccsOA7l8.o: in function `main':
grader.cpp:(.text.startup+0x277): undefined reference to `minimum_closure_costs(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status