Coup
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 64 megabytes
You are given an array and need to handle two types of queries:
1 L R - Reverse the segment of the array from index L to R (inclusive).
2 L R - Determine the minimum value within the segment of the array from index L to R (inclusive).
Input
The first line of the input contains two integers, n and m (1 ≤ n, m ≤ 10^5). The second line contains n integers a_i (1 ≤ a_i ≤ 10^9), representing the initial array. The following m lines each contain a query in the specified format. For the integers L and R, the constraint (1 ≤ L, R ≤ n) holds.
Output
For each query of type 2, print the result on a new line.
Examples
Input #1
Answer #1
Submissions 445
Acceptance rate 31%