Submission #466567

#TimeUsernameProblemLanguageResultExecution timeMemory
466567dattranxxxRace (IOI11_race)C++11
Compilation error
0 ms0 KiB
#include "race.h" /* * Author : shora */ #include <bits/stdc++.h> #define print(_v) for (auto &_ : _v) {cerr << _ << ' ';} cerr << endl; using namespace std; using ll = long long; const int oo = 1e9; const int N = 5e5, K = 1e6; struct C { int v, w; C(int v, int w): v(v), w(w) {} }; vector<C> G[N]; int vis[N], size[N], f[K + 1], dep[N]; int k; int res = oo; void find_size(int u, int e = -1) { size[u] = 1; for (C& c : G[u]) if (c.v != e && !vis[c.v]) { find_size(c.v, u); size[u] += size[c.v]; } } int centroid(int s, int u, int e = -1) { for (C& c : G[u]) if (c.v != e && !vis[c.v]) if (size[c.v] > s / 2) return centroid(s, c.v, u); return u; } void dfs(int u, int e = -1, ll dis = 0) { if (k < dis) return; if (e != -1) dep[u] = dep[e] + 1; if (f[k - dis] != oo) res = min(res, f[k - dis] + dep[u]); for (C& c : G[u]) if (c.v != e && !vis[c.v]) { dfs(c.v, u, dis + c.w); } f[dis] = min(f[dis], dep[u]); } void clear(int u, int e = -1, ll dis = 0) { if (k < dis) return; dep[u] = 0; for (C& c : G[u]) if (c.v != e && !vis[c.v]) { clear(c.v, u, dis + c.w); } f[dis] = oo; } void solve(int u) { find_size(u); u = centroid(size[u], u); vis[u] = 1; dfs(u); clear(u); for (C& c : G[u]) if (!vis[c.v]) solve(c.v); }

Compilation message (stderr)

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