cf/mirror

Permutation Partitions

CF
1326C1300· pupil1s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
3 2
2 1 3
Output
5 2
Sample 2of 3
Input
5 5
2 1 5 3 4
Output
15 1
Sample 3of 3
Input
7 3
2 7 3 1 5 4 6
Output
18 6
1326C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)