4970. Rotate
时间限制:1000 MS 内存限制:256 MB
题目描述
## 题目描述 Write a program which reads a sequence of integers A={a0,a1,...,an-1}A={a0,a1,...,an-1} and rotate specified elements by a list of the following operation: - rotate(b,m,eb,m,e): For each integer kk (0\lek<(e-b)0\lek<(e-b)), move element b+kb+k to the place of element b+((k+(e-m))mod(e-b))b+((k+(e-m))mod(e-b)). ## 输入格式 The input is given in the following format. ``` nn a0a1...,an−1a0a1...,an−1 qq b1m1e1b1m1e1 b2m2e2b2m2e2 : bqmqeqbqmqeq ``` In the first line, nn (the number of elements in AA) is given. In the second line, aiai (each element in AA) are given. In the third line, the number of queries qq is given and each query is given by three integers bimieibimiei in the following qq lines. ## 输出格式 Print all elements of AA in a line after performing the given operations. Put a single space character between adjacency elements and a newline at the end of the last element. ## 数据范围 - 1\len\le1,0001\len\le1,000 - -1,000,000,000\leai\le1,000,000,000-1,000,000,000\leai\le1,000,000,000 - 1\leq\le1,0001\leq\le1,000 - 0\lebi\lemi<ei\len0\lebi\lemi<ei\len ## 输入 ```in1 11 1 2 3 4 5 6 7 8 9 10 11 1 2 6 9 ``` ## 输出 ```out1 1 2 7 8 9 3 4 5 6 10 11 ```