Submission #725699

#TimeUsernameProblemLanguageResultExecution timeMemory
725699sofija6Race (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "race.h" #define MAXN 200010 #define MAXK 1000010 using namespace std; vector<pair<int,int> > G[MAXN]; bool check[MAXN]; int subtree[MAXN],k,res=INT_MAX,ans[MAXK]; void DFS_Subtree(int i,int p) { subtree[i]=1; for (auto next : G[i]) { if (next.first!=p && !check[next.first]) { DFS_Subtree(next.first,i); subtree[i]+=subtree[next.first]; } } } int DFS_Centroid(int i,int p,int root) { for (auto next : G[i]) { if (next.first!=p && !check[next.first] && subtree[next.first]>subtree[root]/2) return DFS_Centroid(next.first,i,root); } return i; } void DFS_Paths(int i,int p,int d,int cnt) { if (d>k) return; if (ans[k-d]) res=min(res,ans[k-d]+cnt); for (auto next : G[i]) { if (next.first!=p) DFS_Paths(next.first,i,d+next.second,cnt+1); } } void DFS_Fill(int i,int p,int d,int cnt) { if (d>k) return; ans[d]=(!ans[d])?cnt : min(ans[d],cnt); for (auto next : G[i]) { if (next.first!=p) DFS_Fill(next.first,i,d+next.second,cnt+1); } } void Solve(int i) { DFS_Subtree(i,i); int c=DFS_Centroid(i,i,i); check[c]=true; for (auto next : G[c]) { DFS_Paths(next.first,c,next.second,1); DFS_Fill(next.first,c,next.second,1); } for (auto next : G[c]) { if (!check[next.first]) Solve(next.first); } }

Compilation message (stderr)

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