Sequence and Queries 19
Time limit2sMemory limit512 MB
Maintain an array under range add, range floor-division by d, and report the minimum and sum over a range. The division step needs a segment tree with min and sum.
- Level
Hard8 of 10
- Topics
- Segment tree, Linked list, Math
- Solved
- No attempts yet
Problem
You are given a sequence of length . Write a program that processes the following four queries.
1 l r c: add to every with .2 l r d: replace every with by .3 l r: print the smallest value among the with .4 l r: print the sum of the with .
is the largest integer that is at most . For example, and .
Input
The first line contains the length of the sequence and the number of queries . ()
The second line contains . ()
Each of the next lines contains one query. (, , )
Output
For every query of type 3 and every query of type 4, print the answer on its own line.