m_nigam01's blog

By m_nigam01, history, 4 years ago, In English

Hello, Codeforces!

I am solving this problem https://codeforces.me/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!

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
4 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

endl is slow when you print lot of lines, use "\n" instead.

Here is an accepted submission.161839419