Recently, I was solving the Graphs section of the CSES problemset and encountered this problem. I used dijkstra algorithm to solve it.
I generally use the template from here, but in this question, this implementation gave me WA. When I used another implementation using visited array, it gave AC.
WA code