Hello, For this Problem i made this submission during contest but it failed system test on only one case with error(uncaught exception with no output). test case is same as i am providing in my main function. when i run on my local machine, ideone, etc it was printing correct answer.
later i made this submission and it passed system test. Only change i made in second submission is i changed vis array from int to bool and it got accepted.
I was applying dijkstra algorithm as N<=5e6 and each node have atmost 2 edges so it should run in 1-2 sec (since it does not require to create adjacency list so i was just using distance & visit array with priority queue) and time limit for problem was 3 sec. So TLE shouldn't be case (If TLE is case then how would it got accepted by changing data type of vis array).
What could be the reason behind this unusual behaviour. Please Help
Many coders fail system test in this problem. Was your reason is similar to this?