Magical Permutation
1163E2400· grandmaster1s256 MB⌨ stdin/stdout
Examples
Sample 1of 6
Input
31 2 3
Output
20 1 3 2
Sample 2of 6
Input
22 3
Output
20 2 1 3
Sample 3of 6
Input
41 2 3 4
Output
30 1 3 2 6 7 5 4
Sample 4of 6
Input
22 4
Output
00
Sample 5of 6
Input
120
Output
00
Sample 6of 6
Input
11
Output
10 1
58%
1163E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…