### ScarletS's blog

By ScarletS, history, 2 months ago,

Solution

Solution

Solution

Solution

Solution

## F — Potion

Solution

• +34

 » 2 months ago, # |   +44 Right before posting this the first time, I ended up deleting it accidentally and had to rewrite it :)
 » 2 months ago, # |   +3 A,B and C were easier this time..
 » 2 months ago, # |   +14 Why the LATEX disappears 5 second after opening some solution?
•  » » 2 months ago, # ^ |   0 Is it still being weird?
•  » » » 2 months ago, # ^ |   0 Why my code showing TLE at after_contest_2 and after_contest_3 test caseMy submission link
•  » » » » 2 months ago, # ^ |   +1 That's because, when you are updating the distance in the priority queue, you should also delete the previous wrong distance which might be already present in the priority queue. In your code, multiple copies of the wrong distance are increasing as you are only deleting the top one. Hence queue size is increasing very fast. Ultimately results in TLE.
•  » » » » » 7 weeks ago, # ^ |   0 Or we can do this: if (dis[u] < d) continue;
•  » » » 2 months ago, # ^ |   +6 Not now, thanks sir:).
 » 2 months ago, # | ← Rev. 6 →   0 Sub to D Can someone help me with this code? My approach was to find b such that $a_nb^n=m$, and the required answer if possible will be lesser than b, so that i will decrement till i find the polynomial to be less than m.Random tc Can someone also explain this as well? My code when i stress tested it worked fine for $m<=10^{16}$
 » 7 weeks ago, # | ← Rev. 3 →   0 .
•  » » 7 weeks ago, # ^ |   0 It's part of the standard Dijkstra implementation, it ensures you don't needlessly visit the same node multiple times.