Submission #569346

#TimeUsernameProblemLanguageResultExecution timeMemory
569346AkitiRoad Closures (APIO21_roads)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
struct edge
{
  int a, b, c;  
};
bool compaire(edge g, edge h)
{
    return g.c > h.c;
}
vector <ll> minimum_closure_costs(ll n, vector <ll> u, vector <ll> v, vector <ll> w)
{
    ll sum = 0;
    ll m = u.size();
    vector <edge> d(m);
    vector <ll> t;
    for (ll i = 0; i < m; i++)
    {
        sum+= w[i];
        d[i].a = u[i];
        d[i].b = v[i];
        d[i].c = w[i];
    }
    sort(d.begin(), d.end(), compaire);
    for (ll k = 0; k <= m; k++)
    {
        ll sum2 = sum;
        for (ll i = 0, s = k; s > 0; i++, s--)
            sum2-= d[i].c;
        t.push_back(sum2);
    }
    return t;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccos3u4Q.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