CF #822 Problem D recursion solution TLE

Revision en1, by Kuber, 2022-09-23 18:13:40

https://mirror.codeforces.com/contest/1734/submission/173209974

Hi

Please refer to the above submission. I gather it is O(n) solution but I'm getting TLE. When I put print command inside the recursive function, it grows linearly with n.

Can anyone help me understand why I'm getting TLE?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Kuber 2022-09-23 18:13:40 330 Initial revision (published)