Help needed in CSES-Coin Collector!

Revision en4, by EternalThread, 2021-09-25 19:04:57

Anyone who has knowledge of condensation graphs or strongly connected components can help.
Problem Link:- Coin Collector

I have two codes one was not accepted and one was accepted just by adding a reverse(all(root_nodes)(which basically reverses the vector) in line number 80 and the code was accepted. Can anyone please tell me the reason for this??

WA Code
Accepted Code

Thanks in advance!!


  Rev. Lang. By When Δ Comment
en4 English EternalThread 2021-09-25 19:04:57 12 Tiny change: 'he reason behind this.\n\n[WA Co' -> 'he reason for this??\n\n[WA Co'
en3 English EternalThread 2021-09-25 18:14:26 4082
en2 English EternalThread 2021-09-25 18:03:10 0 (published)
en1 English EternalThread 2021-09-25 18:02:41 4598 Initial revision (saved to drafts)