Submission #320013

#TimeUsernameProblemLanguageResultExecution timeMemory
320013nekiRace (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include "race.h" #include <bits/stdc++.h> #define loop(i, a, b) for(long long i=a;i<b;i++) #define pool(i, a, b) for(long long i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll int #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 201000 #define pa pair<ll, ll> #define ld long double vc<pa> edg[mn]; ll n, k, vis[mn], ans=0; ll fnd(ll st){ vc<ll> sz(n, 1); function<void (ll, ll)> psa=[&](ll u, ll p){ fore(v, edg[u]) if(!vis[v.fi] and v.fi!=p) psa(v.fi, u), sz[u]+=sz[v.fi]; }; psa(st, -1); function<ll (ll, ll)> dfs=[&](ll u, ll p){ fore(v, edg[u]) if(!vis[v.fi] and v.fi!=p and sz[v.fi]>n/2) return dfs(v.fi, u); return u; }; return dfs(st, -1); } vc<ll> cur; void getd(ll u, ll p, ll dist){ cur.ps(dist); fore(v, edg[u]) if(!vis[v.fi] and v.fi!=p) getd(v.fi, u, dist+v.se); } void dec(ll st){ ll c=fnd(st); map<ll, ll> al;al[0]=1; fore(v, edg[c]) if(!vis[v.fi]){ cur.clear(); getd(v.fi, c, v.se); fore(d, cur) if(al.find(k-d)!=al.end()) ans+=al[k-d]; fore(d, cur) al[d]++; } vis[c]=1; fore(v, edg[c]) if(!vis[v.fi]) dec(v.fi); } ll bestpath(ll N, ll K, ll h[][2], ll l[]){ n=N, k=K; loop(i, 0, n-1){ edg[h[i][0]].ps(make_pair(h[i][1], l[i])); edg[h[i][1]].ps(make_pair(h[i][0], l[i])); } dec(0); return ans; }

Compilation message (stderr)

/tmp/ccQdczwT.o: In function `main':
grader.cpp:(.text.startup+0x24): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status