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

Автор Jady, история, 13 месяцев назад, По-английски

I was trying to solve CSES Shortest Routes I using priority_queue. However, I faced TLE even though I was storing negative of distance in it. After a bit of reading on CP-Algo's Page, they said that

The main difference to the implementation with set is that in many languages, including C++, we cannot remove elements from the priority_queue (although heaps can support that operation in theory).

I have a question regarding this: What happens when pq.pop() is called? Does it not remove the top element from pq?

PS: CF Rookie here, Please do not downvote. Update: Explained on USACO

Полный текст и комментарии »

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

Автор Jady, история, 23 месяца назад, По-английски

Problem: Facetook Priority Wall

Accepted Solution: Accepted
Runtime error on test case 18: Runtime error

Only main difference between the two submission is of how we implement comparison. Thoughts?
ps: codeforces rookie here, please don't downvote me :)

Полный текст и комментарии »

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