问题 M: SuperMemo
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:1
解决:1
题目描述
Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, A1,A2,…An. Then the host performs a series of operations and queries on the sequence which consists:
- ADD x y D: Add D to each number in sub-sequence Ax…Ay. For example, performing "ADD 2 4 1" on {1, 2, 3, 4, 5} results in {1, 3, 4, 5, 5}
- REVERSE x y: reverse the sub-sequence Ax…Ay. For example, performing "REVERSE 2 4" on {1, 2, 3, 4, 5} results in {1, 4, 3, 2, 5}
- REVOLVE x y T: rotate sub-sequence {Ax ... Ay} T times. For example, performing "REVOLVE 2 4 2" on {1, 2, 3, 4, 5} results in {1, 3, 4, 2, 5}
- INSERT x P: insert P after Ax. For example, performing "INSERT 2 4" on {1, 2, 3, 4, 5} results in {1, 2, 4, 3, 4, 5}
- DELETE x: delete Ax. For example, performing "DELETE 2" on {1, 2, 3, 4, 5} results in {1, 3, 4, 5}
- MIN x y: query the participant what is the minimum number in sub-sequence Ax…Ay. For example, the correct answer to "MIN 2 4" on {1, 2, 3, 4, 5} is 2
输入
The first line contains n (n≤100000).
The following n lines describe the sequence.
Then follows M (M≤100000), the numbers of operations and queries.
The following M lines describe the operations and queries.
The following n lines describe the sequence.
Then follows M (M≤100000), the numbers of operations and queries.
The following M lines describe the operations and queries.
输出
For each "MIN" query, output the correct answer.
样例输入 复制
5
1
2
3
4
5
2
ADD 2 4 1
MIN 4 5
样例输出 复制
5