Help needed in Codeforces Div2 1061 C2

Revision en1, by alyosha, 2025-10-25 18:51:32

https://mirror.codeforces.com/contest/2154/submission/345771218, this is my solution of the problem. I am not sure why it's failing I am using the exact same idea as in editorial. It's giving TLE due to some implementation error. Can you someone please correct. Any input is welcome. I have tried to comment the code a bit to make the parts of it understandable. Please ask for any clarification if needed. Thanks

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English alyosha 2025-10-25 18:51:32 448 Initial revision (published)