Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя Byncuco

Автор Byncuco, история, 4 года назад, По-английски

I tried to solve a classic probjem by using dijkstra with set, but got TLE.

I could not find out the reason why. Here is my code: Submission 65475444

Can you suggest any reasons? Thank you!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

I just tinkered your solution a little bit and the reason I think you are getting TLE may be due to accessing pair elements more than once I just stored them in variables. For your curiosity, I made the same mistake xd and also you can speed this up using priority queue more here.

Modified Code

cheers :)