Help with error

no not about time complexity , the cost may exceed the range of int if the constraints on the cost are high .
change int to long long and then try submitting.

if fails then try submiting it on other plaforms where constraints and input/output are clearly mentioned.

I don’t think that is the case because the cost is in the range of int


for example here but it is still not passing

if all test cases are like this then yeah thats is definetely not a reason still try submiting it using long long.

the logic for dijkastra is also correct(submit it over other platforms to verify).

the only thing that is left is input ,so the issue is probably with input that they have not expained clearly.

I wanted to know that why do we use set instead of pq( we were told updation is not possible in pq ) and how it effects the time complexity because I saw in other implementations online priority queue was being used .

yeah key updation is not possible in pq , wherease in set we can easily modify it in log(n) and it will also keep the keys in sorted order these were the reason why we are using set over pq.

yeah we can use pq as well, time complexity wise it will remain same.
refer this for better clarity->link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.