Problem H. Rotate
时间限制 1000 ms
内存限制 32 MB
Recently yifenfei face such a problem that give you millions of positive integers,tell how many pairs i and j that satisfy F[i] smaller than F[j] strictly when i is smaller than j strictly. i and j is the serial number in the interger sequence. Of course, the problem is not over, the initial interger sequence will change all the time. Changing format is like this [S E] (abs(E-S)<=1000) that mean between the S and E of the sequece will Rotate one times.
For example initial sequence is 1 2 3 4 5.
If changing format is [1 3], than the sequence will be 1 3 4 2 5 because the first sequence is base from 0.
输入数据
输出数据
Output just according to said.
样例输入
复制
5
1 2 3 4 5
3
Q
R 1 3
Q
样例输出
$ Mathjax font initiator $