As the next DP problem from Codeforces, solve "Consecutive Subsequence". This problem shows how the same four-step DP pattern works even when the values in the array are large.
You are given a sequence . find a subsequence (delete some elements, but you must keep the order) such that consecutive elements in the subsequence differ by exactly one. for indices of any subsequence you want Every .
Among all such subsequences, you want the one with maximum length. You have to output the maximum length and the indices of the subsequence with the maximum length.
Constraints: