Why does this code get accepted 55539853 and this does not 55539543?
I believe the time complexity of 1st submission is O(k(n+m)) for k bfs and then O(nklog(k)) for sorting each node.
Can someone tell the complexity of the second code because of which it is failing.
For getting s smallest element I am using slog(s) complexity in bfs in 2nd submission.