U517304 「ALFR Round 3」B Swap & Delete
题目背景
[Chinese Statement](P11446).
题目描述
Given a sequence of length $n$, denoted as $a_1, a_2, a_3, \dots, a_n$, you need to perform $k$ operations to make this sequence empty.
Each operation can be one of the following:
1. Select two indices $i, j$ and swap $a_i$ and $a_j$, satisfying $1 \le i < j \le n$.
2. Select two indices $i, j$ and delete the elements $a_i, a_{i+1}, \dots, a_j$, satisfying $1 \le i \le j \le n$, and $a_i = a_j$.
You should output the minimum number of operations $k$ required.
输入格式
无
输出格式
无
说明/提示
| Subtask | Score | Constraints |
| :-----: | :---: | :----------: |
| $1$ | $10$ | $n \le 3$ |
| $2$ | $20$ | $n \le 10$ |
| $3$ | $20$ | $a_i \le 2$ |
| $4$ | $10$ | All $a_i$ are guaranteed to be equal |
| $5$ | $40$ | - |
For all the tests, $1 \le T \le 5$, $1 \le n \le 10^5$, $0 \le a_i \le 10^9$.