Doubts in dsa series

doubt1 - CodeChef: Practical coding for everyone - i am using merge sort tree. I tried stress testing my code still couldnt find out why WA.

my code - CodeChef: Practical coding for everyone

doubt2 - CodeChef: Practical coding for everyone - 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??