What is wrong with my logic?

Revision en1, by m_nigam01, 2022-06-26 10:12:07

Hello, Codeforces!

I am solving this problem https://codeforces.com/contest/1665/problem/B

But I'm getting TLE on test case 13. I don't think there should be any TLE. Please look at my code and guide me what's wrong with my thought process. https://pastebin.com/EmhQpghv

I also optimized my code to get rid of inner while loop https://pastebin.com/5800fc8C But still get TLE on testcase 13.

Thanks for any help or suggestion!


  Rev. Lang. By When Δ Comment
en1 English m_nigam01 2022-06-26 10:12:07 470 Initial revision (published)