시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 1024 MB | 59 | 19 | 16 | 39.024% |
You are given a multiset $s$ consisting of $n$ integers. You should perform the following three-step operation some number of times until a single integer remains in $s$.
Find a sequence of operations that maximizes the integer left in $s$.
The first line contains a single integer $n$ $(2 \le n \le 10^5)$.
The second line contains $n$ integers $s_1, s_2, \ldots, s_n$ $(0 \le s_i \le 10^5)$.
On the first line, print a single integer $k$ $(1 \le k \le n-1)$, the number of operations.
On each of the next $k$ lines, print an integer $m$ $(2 \le m \le n)$, the size of the chosen multiset $t$, followed by $m$ integers, $t_1, t_2, \ldots, t_m$.
Note that the operations are executed in the same order they are listed. So, for each operation, $t$ must be a subset of $s$ when all the preceding operations are performed.
번호 | 배점 | 제한 |
---|---|---|
1 | 10 | $s_{i+1} = s_i + 1$ (for all $1 \le i \le n - 1$) |
2 | 40 | $n \le 100, s_i \le 1000$ (for all $1 \le i \le n$) |
3 | 50 | No additional constraints. |
7 33 24 63 48 97 90 93
4 3 33 93 90 2 63 60 2 48 24 3 97 24 3
The sample does the following operations:
Chosen $t$ | New $s$ | |
$0$ | $\{24, 33, 48, 63, 90, 93, 97\}$ | |
$1$ | $\{33, 90, 93\}$ | $\{24, 48, \underline{60}, 63, 97\}$ |
$2$ | $\{60, 63\}$ | $\{\underline{3}, 24, 48, 97\}$ |
$3$ | $\{24, 48\}$ | $\{3, \underline{24}, 97\}$ |
$4$ | $\{3, 24, 97\}$ | $\{\underline{94}\}$ |
The values underlined in $s$ denote the integer inserted. After the fourth operation, $s$ is reduced to a single integer value of $94$. It can be shown that no other sequence of operations results in a larger value.