#C14105. Longest Contiguous Arithmetic Progression Subarray

    ID: 43718 Type: Default 1000ms 256MiB

Longest Contiguous Arithmetic Progression Subarray

Longest Contiguous Arithmetic Progression Subarray

Given a list of integers, your task is to determine the length of the longest contiguous subarray that forms an arithmetic progression (AP). An arithmetic progression is a sequence where the difference between consecutive terms is constant. Mathematically, an AP can be defined as follows: \(a_n = a_1 + (n-1)d\), where \(d\) is the common difference.

For example, if the input array is [10, 7, 4, 6, 8, 10, 11], the longest contiguous subarray that is an arithmetic progression is [4, 6, 8, 10], which has a length of 4.

You need to read the input from stdin and output the answer to stdout.

inputFormat

The first line of input contains a single integer \(n\), the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

Output a single integer representing the length of the longest contiguous subarray that forms an arithmetic progression.

## sample
1
1
1