CF407E k-d-sequence
Description
We'll call a sequence of integers a good $ k $ - $ d $ sequence if we can add to it at most $ k $ numbers in such a way that after the sorting the sequence will be an arithmetic progression with difference $ d $ .
You got hold of some sequence $ a $ , consisting of $ n $ integers. Your task is to find its longest contiguous subsegment, such that it is a good $ k $ - $ d $ sequence.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first test sample the answer is the subsegment consisting of numbers 2, 8, 6 — after adding number 4 and sorting it becomes sequence 2, 4, 6, 8 — the arithmetic progression with difference 2.