#P9285. [AGM 2023 资格赛] YsaeSort
[AGM 2023 资格赛] YsaeSort
Problem Description
Given a sequence of length , you will perform operations:
-
means sorting the interval .
-
is a query: if you perform bubble sort on this interval, what is the maximum product of the two adjacent numbers that get swapped.
It is guaranteed that the intervals sorted by operation are pairwise disjoint or one contains another.
Input Format
The first line contains an integer , the number of elements in the array.
The second line contains integers , the elements of the array.
The third line contains an integer , the number of operations.
Each of the next lines contains one query described above.
Output Format
Output lines. For each query, output the answer.
10
10 9 8 7 6 5 4 3 2 1
11
1 1 2
2 1 2
2 1 3
2 1 10
2 9 10
1 3 4
2 1 4
2 3 4
2 2 3
1 1 4
2 1 4
0
80
80
2
80
0
70
0
Hint
Translated by ChatGPT 5