P8259It's Gonna be AK | ||
|
问题描述
Given a sequence $X$ of integers with length $n$, let $F(X)$ be the number of elements that occur in $X$ exactly twice.
You are given a sequence \(A\). Find a contiguous subsequence \(A'\) of \(A\) that maximizes \(F(A')\) and just print the maximum value of \(F(A')\).
输入格式
The first line contains an integer \(n\), which indicates the length of \(A\)
The second line contains \(n\) integers
$0 < n \leqslant 2 \cdot 10^5$
$0 \leqslant A_i \leqslant 10^9$
输出格式
Output one line containing the maximum value of \(F(A')\).
样例输入 1
10
2 3 3 3 4 3 4 3 3 1
样例输出 1
2
样例输入 2
14
0 2 2 1 0 0 6 0 6 0 2 1 1 0
样例输出 2
3