| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 256 MB | 1 | 0 | 0 | 0.000% |
One of Sophie's tasks as a sales department employee is creating graphs of sales volumes. She has access to all the data, namely the integer sales volumes from the last $n$ months. Having glanced at the figures already, she knows that these numbers are pairwise different. The snag is that Sophie's boss expects impressive graphs, and not one but $k$ of them! A graph is impressive if the sequence of sales volumes in it is increasing. While Sophie can create empty graphs, she cannot get too creative. Namely, she has to conform with the following rules:
The more sales volumes are used in a set of graphs, the more impressive it is.
Help Sophie in finding the most impressive set of $k$ graphs. That is, write a program that will: read the number of sales volumes, the number of sales graphs to be created, and the monthly sales volumes themselves, determines the most impressive set of sales graphs, and prints it to the standard output. If the most impressive set of sales graphs is not unique, your program may choose any of them.
In the first line of input, there are two integers $n$ and $k$ (1ドル \le n \le 200,000円,ドル 1ドル \le k \le 20$), separated by a single space. These specify the number of sales volumes and the number of graphs, respectively. In the second (and last) line of input, there are $n$ pairwise different integers $a_1, a_2, \ldots, a_n$ (1ドル \leq a_i \leq n$), separated by single spaces. These are the sales volumes from successive months.
Your program should print exactly $k+1$ lines. The first line should contain a single integer: the maximum number of sales volumes that can be used in a set of $k$ impressive graphs. The next $k$ lines should describe those graphs, one per line. A single description should consist of an integer $\ell$ ($\ell \geq 0$) --- the number of sales volumes in the graph --- followed by these volumes, i.e., $\ell$ integers $a_{i_1}, a_{i_2}, \ldots, a_{i_{\ell}}$ such that $i_1 < i_2 < \ldots < {i_\ell}$ and $a_{i_1} < a_{i_2} < \ldots < a_{i_\ell}$. All these numbers are separated by single spaces.
6 2 6 4 1 5 3 2
4 2 1 2 2 4 5
5 1 5 1 2 4 3
3 3 1 2 3
In first sample, the plots in the most impressive set of plots both have 2ドル$ sales volumes: 1,ドル 2$ in one plot and 4,ドル 5$ in the other.