No.3543 Progression (All Language)
タグ : / 解いたユーザー数 24
作問者 :
Rho
/ テスター :
Problem Statement
You are given a sequence of positive integers $A = (A_1, A_2, \ldots, A_N)$ of length $N$.
Find the length of the longest contiguous subarray of $A$ that is an arithmetic progression.
Input
$N$ $A_1\ A_2\ \ldots\ A_N$
- All input values are integers
- $1 \leq N \leq 2000$
- $1 \leq A_i \leq 10^9$
Output
Print the answer on one line.
Trailing newlines and whitespace may be present or absent.
Score
Reference solution: $69$ bytes
Score formula
When the code length of a submitted source code is $x$ and the code length of the reference solution for this problem is $y$, the score of that source code is $\max(500 - x + y, 100) / 2$ points.The score for this problem is the maximum of the scores of the source codes submitted to this problem.
Sample Program (Whitespace)
An example solution in Whitespace is shown below. By submitting this code, you can get $50$ points.
Sample
Sample 1
Input
5 3 1 4 7 5
Output
3
The contiguous subarray $(A_2, A_3, A_4)=(1, 4, 7)$ of $A$ is an arithmetic progression, and its length is $3$.
No contiguous subarray of $A$ that is an arithmetic progression has length greater than $3$, so print $3$.
Sample 2
Input
5 3 1 4 1 5
Output
2
Sample 3
Input
1 1000000000
Output
1
Sample 4
Input
10 10 9 8 7 6 5 4 3 2 1
Output
10
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。