Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Bob travels along a fixed path (from node “bob” to node 0).
Calculate Alice’s distance to each node via DFS.
We can calculate Alice’s score along a path ending at some node easily using Hints 1 and 2.