#P6011. [SCOI2006] 动态最值
[SCOI2006] 动态最值
Problem Description
You are given an array containing elements. You need to support the following operations:
DELETE k: Delete the number at position . All numbers to the right shift one position to the left.QUERY i j: Query the minimum and maximum values among all numbers in positions .
For example, there are elements:
| Position | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Element |
The result of QUERY 2 8 is 2 9. After performing DELETE 3 and then DELETE 6 (note that this deletes the element from the original array), the array becomes:
| Position | ||||||||
|---|---|---|---|---|---|---|---|---|
| Element |
The result of QUERY 2 8 is 1 7.
Input Format
The first line contains two integers , representing the number of elements in the original array and the number of operations.
The second line contains integers, representing the original array.
The next lines each describe an operation in the form 1 k or 2 i j, where the first number is for a delete operation, and for a query operation.
Output Format
For each query operation, output one line containing two integers: the minimum value and the maximum value in that range.
10 4
1 5 2 6 7 4 9 3 1 5
2 2 8
1 3
1 6
2 2 8
2 9
1 7
Hint
For of the testdata, , and there are no more than delete operations.
For of the testdata, , and the absolute value of each array element does not exceed .
Translated by ChatGPT 5