#P12673. 「LAOI-8」Change
「LAOI-8」Change
Description
You are given two sequences, and , each containing distinct integers. In one operation, you may select any pair of indices such that for some positive integer , and swap and . 
It is guaranteed that , but the sorted sequences of and are equal.
Please find all possible so that can be transformed into through several operations.
Input Format
The first line contains an integer .
The second line contains integers: the initial sequence .
The third line contains integers: the target sequence .
Output Format
If there are valid integers , output lines, each with one positive integer.
Output all valid in ascending order.
5
1 2 3 4 5
1 2 3 5 4
1
5
1 2 3 5 4
1 3 4 2 5
1
5
1 4 3 2 5
1 2 3 4 5
1
2
Hint
Subtasks are used in this problem.
| Subtask | Constraint | Special Property | Score |
|---|---|---|---|
| None | |||
| None |
Special Property : Only two elements differ in position between and .
For all test cases, it is guaranteed that , .
京公网安备 11011102002149号