Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pt restrictie (a,b):
- ans[a] = 0
- for(int nn: g[a]) dfs(nn, a, b);
- ...
- void dfs(int nod, int prev, int b) {
- if (ans[nod] == 0 || dist(nod,b) < dist(prev,b)) return;
- ans[nod] = 0;
- for(int nn: g[nod]) dfs(nn, nod, b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement