Codeforces and Polygon may be unavailable from May 23, 4:00 (UTC) to May 23, 8:00 (UTC) due to technical maintenance. ×

CSES Shortest Routes 1

Revision en1, by manijuana, 2020-06-23 01:48:56

I'm having trouble implementing a typical dijikstra problem (this one). I'm having a TLE verdict in the last subtask. My submission can be found here. I'm using a set to store the nodes and having a compare function which sorts on the basis of the shortest distances stored in vector d. Everytime a relaxation is encountered, it removes the node, relaxes and changes d[] for that node and enters it again into the set. Can anyone help me get rid of this TLE and tell me why I'm getting one? Thanks in advance.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English manijuana 2020-06-23 01:48:56 605 Initial revision (published)