304529: CF863D. Yet Another Array Queries Problem
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Yet Another Array Queries Problem
题意翻译
给你一个数列a和q步操作,询问m次,每次询问操作完的数列的第b个数字是多少. 操作分两种:输入t,l,r. t=1:将[l,r]区间向右移动一格,l~r-1的区间变成l+1~r,然后将a[r]移动到a[l]的位置. t=2:翻转区间[l,r]. 感谢 @Fuko_Ibuki 提供的翻译。题目描述
You are given an array $ a $ of size $ n $ , and $ q $ queries to it. There are queries of two types: - $ 1 $ $ l_{i} $ $ r_{i} $ — perform a cyclic shift of the segment $ [l_{i},r_{i}] $ to the right. That is, for every $ x $ such that $ l_{i}<=x<r_{i} $ new value of $ a_{x+1} $ becomes equal to old value of $ a_{x} $ , and new value of $ a_{li} $ becomes equal to old value of $ a_{ri} $ ; - $ 2 $ $ l_{i} $ $ r_{i} $ — reverse the segment $ [l_{i},r_{i}] $ . There are $ m $ important indices in the array $ b_{1} $ , $ b_{2} $ , ..., $ b_{m} $ . For each $ i $ such that $ 1<=i<=m $ you have to output the number that will have index $ b_{i} $ in the array after all queries are performed.输入输出格式
输入格式
The first line contains three integer numbers $ n $ , $ q $ and $ m $ ( $ 1<=n,q<=2·10^{5} $ , $ 1<=m<=100 $ ). The second line contains $ n $ integer numbers $ a_{1} $ , $ a_{2} $ , ..., $ a_{n} $ ( $ 1<=a_{i}<=10^{9} $ ). Then $ q $ lines follow. $ i $ -th of them contains three integer numbers $ t_{i} $ , $ l_{i} $ , $ r_{i} $ , where $ t_{i} $ is the type of $ i $ -th query, and $ [l_{i},r_{i}] $ is the segment where this query is performed ( $ 1<=t_{i}<=2 $ , $ 1<=l_{i}<=r_{i}<=n $ ). The last line contains $ m $ integer numbers $ b_{1} $ , $ b_{2} $ , ..., $ b_{m} $ ( $ 1<=b_{i}<=n $ ) — important indices of the array.
输出格式
Print $ m $ numbers, $ i $ -th of which is equal to the number at index $ b_{i} $ after all queries are done.
输入输出样例
输入样例 #1
6 3 5
1 2 3 4 5 6
2 1 3
2 3 6
1 1 6
2 2 1 5 3
输出样例 #1
3 3 1 5 2