|
||||||||||
PermutationTime Limit: 14000/7000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 24 Accepted Submission(s): 4 Problem Description Given $\{a_i\}$, a permutation of $1...n$, you need to perform the following operations:
Input This problem contains multiple test cases. The first line contains a single integer $T$($1 \leq T \leq 10$), the number of test cases. Each test case starts with a line of two integers $n,m(1\le n,m\le 10^5)$, the initial length of the permutation and the number of operations. Then follows a line of $n$ numbers, representing a permutation of $1...n$. For the following $m$ lines, each line is of the following format:
Output For each print operation, print a single integer in a line denoting the answer. Sample Input
Sample Output
Source | ||||||||||
|