I was trying to solve this problem on codeforces.
I realised that I had to implement Dijkstra’s in order to solve it. However, my submission that used priority_queue in the implementation received TLE.
However, the same algorithm but with set gives AC. I reckon that Insertion and Deletion in both set and priority_queue takes log(n) time. So, how is a set faster in this case?