Been stuck on this for a long time. Can’t figure out whats wrong:

https://www.codechef.com/viewsolution/25350090

My approach:

(By bhagirathi08)

Reference: https://www.youtube.com/watch?v=jxVzUg7oSP8

Been stuck on this for a long time. Can’t figure out whats wrong:

https://www.codechef.com/viewsolution/25350090

My approach:

(By bhagirathi08)

Reference: https://www.youtube.com/watch?v=jxVzUg7oSP8

1 Like

This is how I solved the problem.

I solved this 2-months ago while practicing dp:-

Now, using its concepts CIMERGE can be solved.

2 Likes

Thanks! I’ll try this…

But I really suck at dp, always end up looking at the editorial… any tips? How do you approach dp?

1 Like

You just have to change INT_MAX to some large value. INT_MAX has value of 2147483647 but the larger testcases may exceed this.

1 Like

There is another INT_MAX inside the f function.

1 Like

THANKS!!! It Worked!