https://www.hackerearth.com/challenges/competitive/september-clash-15/algorithm/dangerous-dungeon/description/ i have got the solution for small p by calculating dist[u][p] for every p how can we do it such that solution is independent of the value of p