cf/mirror

Minimize the Permutation

CF
1256B1400· specialist1s256 MB⌨ stdin/stdout
#greedy

Examples

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