#P10689. SuperMemo
SuperMemo
题目描述
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, . Then the host performs a series of operations and queries on the sequence which consists:
ADD x y D
: Add to each number in sub-sequence . For example, performing "ADD 2 4 1" on results inREVERSE x y
: reverse the sub-sequence . For example, performing "REVERSE 2 4" on results inREVOLVE x y T
: rotate sub-sequence times. For example, performing "REVOLVE 2 4 2" on results inINSERT x P
: insert after . For example, performing "INSERT 2 4" on results inDELETE x
: delete . For example, performing "DELETE 2" on results inMIN x y
: query the participant what is the minimum number in sub-sequence . For example, the correct answer to "MIN 2 4" on is
To make the show more interesting, the participant is granted a chance to turn to someone else that means when Jackson feels difficult in answering a query he may call you for help. You task is to watch the TV show and write a program giving the correct answer to each query in order to assist Jackson whenever he calls.
输入格式
The first line contains ().
The following lines describe the sequence.
Then follows (), the numbers of operations and queries.
The following 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