problem link : http://mirror.codeforces.com/gym/101341/problem/K
My solution : http://paste.ubuntu.com/25525923/
I've used recursive interval DP technique . But don't know why my solution is not working .
Thanks in advance :)
Edit : My bad .. Found the mistake . Never mind. :)