#P1420. 最长连号
最长连号
Description
Given a sequence of positive integers of length , output the length of the longest consecutive sequence in the sequence.
“Consecutive” means consecutive natural numbers in increasing order that appear in the sequence.
Input Format
The first line contains an integer .
The second line contains integers , separated by spaces.
Output Format
Output one integer: the number of elements in the longest consecutive sequence.
10
1 5 6 2 3 4 5 6 8 9
5
Hint
Constraints
For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号