cf/mirror

Permutations

CF
48D1500· specialist1s256 MB⌨ stdin/stdout
#greedy

Examples

Sample 1of 3
Input
9
1 2 3 1 2 1 4 2 5
Output
3
3 1 2 1 2 2 2 3 2
Sample 2of 3
Input
4
4 3 2 1
Output
1
1 1 1 1
Sample 3of 3
Input
4
1 2 2 3
Output
-1
48D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)