#P7706. 「Wdsr-2.7」文文的摄影布置
「Wdsr-2.7」文文的摄影布置
Description
Although there are many pictures, luckily, Wenwen has already arranged them into a line, numbered from left to right as . The three pictures Wenwen chooses should form a subsequence of length . (Let the chosen photo indices be , then it must satisfy .)
In addition, Wenwen assigns each photo an attractiveness and a size .
Because an overly large newspaper layout will reduce readers' interest, after choosing two photos , it is required that the smallest must be chosen.
Formally, define , where it needs to satisfy .
After figuring out how to compute the value of the photos, Wenwen will give you a total of operations, which can be divided into the following three types:
-
: The attractiveness of a photo changes. Wenwen modifies to .
-
: The size of a photo changes. Wenwen modifies to .
-
: Wenwen plans to use the pictures from the -th to the -th in the material library. You need to tell her the maximum value of ( ).
Input Format
The first line contains two integers , representing the number of photos and the number of operations.
The second line contains integers, representing the sequence , describing the attractiveness of each photo.
The third line contains integers, representing the sequence , describing the size of each photo.
The next lines each describe an operation, in the format described above.
Output Format
For each type 3 operation, output one line with one integer, representing the answer.
6 6
1 4 2 3 5 6
5 3 4 1 6 7
3 2 5
3 1 6
1 2 3
3 1 6
2 6 1
3 1 6
8
9
8
8
Hint
Constraints and conventions
$$\def\arraystretch{1.5} \begin{array}{|c|c|c|c|}\hline \textbf{Subtask} & \bm{n,m} & \textbf{Special property} & \textbf{Score}\cr\hline 1 & 1\le n,m\le 300 & \text{None} & 10\cr\hline 2 & 1\le n,m\le 5\times 10^3 & \text{None} & 20\cr\hline 3 & 1\le n,m\le 5\times 10^5 & \text{Only operation 3} & 20\cr\hline 4 & 1\le n,m\le 10^5 & \text{None} & 20\cr\hline 5 & \text{No special restrictions} & \text{None} & 30\cr\hline \end{array}$$-
For of the testdata:
.
, , .
It is guaranteed that , i.e., the length of the queried interval is at least .
Translated by ChatGPT 5
京公网安备 11011102002149号