cf/mirror

Maximum Permutation

CF
1774H3500· legendary gm2s256 MB⌨ stdin/stdout

Examples

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