Doubts in dsa series

doubt1 - - i am using merge sort tree. I tried stress testing my code still couldnt find out why WA.

my code -

doubt2 - - my code worked basically dijikstra from all special vertices and return as soon as top of priority_queue > global min - but why did it work whithin time limit??