#P8880. 无知时诋毁原神
无知时诋毁原神
Background
Nahida really likes permutations.
![]()
Artist pid: 72405030
Problem Description
Nahida has a permutation of . She wants you to construct two permutations , also of , such that , . If Nahida's requirement cannot be satisfied, output .
Input Format
The first line contains an integer .
The second line contains integers, representing the permutation .
Output Format
If there is no construction that meets the requirements, output one line with .
Otherwise, output two lines, each with integers. The first line is , and the second line is .
3
2 1 0
2 0 1
0 1 2
4
1 3 0 2
-1
Hint
Constraints
- : .
- : A solution is guaranteed to exist.
- : No special properties.
For of the testdata, it is guaranteed that , and is a permutation.
Translated by ChatGPT 5