| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 73 | 31 | 25 | 47.170% |
You are given an integer sequence $A = (a_1, a_2, \dots , a_N)$. Find the length of the longest sequence $B = (b_1, b_2, \dots , b_N)$ which satisfies the following two conditions:
A subsequence of a sequence is a sequence obtained by removing zero or more elements from the original sequence and then concatenating the remaining elements without changing the order.
$N$
$a_1$ $a_2$ $\dots$ $a_N$
The first line consists of an integer $N$ between $1$ and $5\,000$, inclusive. This represents the number of elements in $A$.
The second line consists of $N$ integers between $1$ and $N$, inclusive. For each $i$ ($1 ≤ i ≤ N $), $a_i$ represents the $i$-th element of $A$.
Print the answer in a line.
7 1 5 7 6 3 4 2
4
7 6 2 1 4 7 5 3
5
2 2 1
2
6 1 1 2 2 3 3
6