第1行N, M, Q (2<=M <= N, 1<=Q <= 5,000)
接下来M行,每行一个p[i]
接下来Q行,每行是一个x[i], 表示一个询问
5 3 5
3
1
2
1
2
3
4
5
4
5
3
1
2
OUTPUT DETAILS:
The shuffle proceeds as:
[1, 2, 3, 4, 5] -> [2, 3, 1, 4, 5] (put 2 face down)
[3, 1, 4, 5] -> [1, 4, 3, 5] (put 1 face down)
[4, 3, 5] -> [3, 5, 4] (put 3 face down)
[5, 4] (put 5 face down)
[4] (put 4 face down)
This produces the final order of [4, 5, 3, 1, 2]
100% 数据,N <= 1,000,000,000, M<=100,000