MAXPR .. PLZ HELP

plz help me in solving this question …

i need clarification … !!
for example if the series is 1 2 3
then the AP sequences are
1 2 3
1 2
2 3
1 3
1
2
3
so total 7…
so non AP sequences are zero
am i correct?

and anyone plz explain me how to solve this using dp in simple manner… i am not understanding the editorial properly …

yes…u r right…
similarly the sequence 1 1 1 1 1 has 0 non ap subsequences

see range of numbers are fixed from 0 to 100. so common difference can only be in range of -100 to 100. Try building table for common difference ending at ending at particular number. So your table will be of size 201*!01.Look at my solution and you will understand. If any doubt leave a comment here…

//