BEAUSUB - Editorial

why did my O(n*k) is giving tle ?
Anyone Help
https://www.codechef.com/viewsolution/49197825

when we will have a video editorial for this problem?

1 Like

Is this not giving TLE as the complexity is more than O(NK)??

It does give TLE, but that reply was for @chandan_125 who wanted to know the code for brute force approach

Sir, please recursive solution and memoization ??

Hmm… I don’t know about any such chart, but as far I know (from problems I have solved/discussed with my friends), ~1e6 operations means O(NlogN) sol… ~1e7 operations means at most O(N) sol…~5e3 means O(N^2)…~20 means O(2^n) or O(n2^n) …usually involves bitmask dp. (Note these are just approximate figures)

Can anybody tell me why my solution is not working?
Ignore the last comment code
Approach: Top-Down DP
Link: CodeChef: Practical coding for everyone

Thankyou. It’s helpful.

Online Judge.

Excatly same thing I was doing , Plz let me know where I am wrong.

Code Link:

Great problem and great solution. Lots of things to learn from this.
Thanks !