TreeSet much faster than PriorityQueue — Dijkstra

Revision en1, by Armyx, 2015-09-23 16:11:15

I solved this problem http://codeforces.com/contest/449/problem/B using dijkstra based on priority queue and I got TLE (http://codeforces.com/contest/449/submission/13186398) on test 45. After that I changed it to TreeSet ( http://codeforces.com/contest/449/submission/13186483 ) and it runs ~940ms instead of > 2000ms . What is wrong with my previous solution ? I read that priority queue runs faster in practice and I saw that most java solutions use priority queue

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Armyx 2015-09-23 16:11:15 516 Initial revision (published)