Here's the problem: https://codeforces.net/contest/2024/problem/D Here's my solution: https://codeforces.net/contest/2024/submission/287835290
I think my code is logically correct, but I am unable to pass test 6 due to TLE.
Help me figure this out please.
Your priority queue is currently like a max heap, use a min heap.