Sequence and Queries 27
Time limit4sMemory limit512 MB
Apply range add, range chmax, and range chmin to array A, then answer the current range minimum of A and the range historical minimum and maximum of past values.
- Level
Hard9 of 10
- Topics
- Segment tree, Implementation
- Solved
- No attempts yet
Problem
You are given a sequence of length . There are also two sequences and of length , where and initially. Write a program that processes the following queries.
1 L R X: For every , add to .2 L R Y: For every , set .3 L R Y: For every , set .4 L R: Print .5 L R: Print .6 L R: Print .
After each query, for every , becomes and becomes .
Input
The first line contains , the length of the sequence. ()
The second line contains . ()
The third line contains , the number of queries. ()
Each of the next lines contains one query. (, , ) Queries 4, 5, and 6 appear at least once.
Output
Print the results of queries 4, 5, and 6, one per line.