Problem A
Heap Partition
A sequence
Chiaki has a sequence
Note that a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
Input
There are multiple test cases. The first line of input
contains an integer
The first line contain an integer
The second line contains
It is guaranteed that the sum of all
Output
For each test case, output an integer
Sample Input 1 | Sample Output 1 |
---|---|
4 4 1 2 3 4 4 2 4 3 1 4 1 1 1 1 5 3 2 1 4 1 |
1 4 1 2 3 4 2 3 1 2 3 1 4 1 4 1 2 3 4 3 2 1 4 1 2 2 3 5 |