cf/mirror

Restore the Permutation by Merger

CF
1385B800· newbie1s256 MB⌨ stdin/stdout
#greedy

Examples

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