ZOJ Problem Set - 4089
Little Sub has a sequence $A_1,A_2,\dots,A_N$. Now he has a problem for you.
Two sequences $X_1, X_2, \dots, X_u$ of length $u$ and $Y_1, Y_2, \dots, Y_v$ of length $v$ are considered isomorphic when they meet all the following two conditions:
Now we have $M$ operations for $A$. and there are two kinds of operations:
There are multiple test cases. The first line of the input contains an integer $T$ ($1 \le T \le 5$), indicating the number of test cases. For each test case:
The first line ontains two integers $N,M \ (1 \le N \le 10^5, 1 \le M \le 10^5)$.
The second line contains $N$ integers $A_1, A_2, \dots, A_N$ ($1 \le A_i \le 10^9$).
In the following $M$ lines, each line contains one operation. The format is described above.
For each operation 2, output one line containing the answer.
1 3 5 1 2 3 2 1 3 2 2 1 1 2 2
-1 1 2
Author: LI, Yankui
Source: ZOJ Monthly, January 2019