This should be a very common introductory problem for dynamic programming. You can use Google to search for exactly the same model.

Yes, the merging problem is well known, except that the Codechef version was â€ścircularâ€ť merging.

In fact, the â€ścircularâ€ť merging version is also well known.

Yeah, It was a standard DP

Disappointed after seeing this.

What happend?

How the algorithm proceed can you explain it ?

In long challenges we expect new questions.

It was classical dynamic problem famously knows as Matrix Multiplication, wondering whatâ€™s the problem if it is, because every problem has some subset logic.

Circular isnâ€™t big deal just be greedy and permute it in such a way that largest element comes at end or in beginning and then itâ€™s simply non-circular.

Indeed, I donâ€™t think this problem should be there.

Yes, so I think this one should be unrated.

Youâ€™re right. Thank you for your commit. It helped me a lot.

This is not how things work here.

Donâ€™t say that I spent lot of time in this contest.

OK, Iâ€™m just kidding.

No man, I would be 4 star after this