#C10313. Image Operations Processing
Image Operations Processing
Image Operations Processing
This problem involves processing a series of operations on an image represented by its pixel intensity values. You are given an initial array of pixel values and a list of operations to perform. There are three types of operations:
- Compress: Given indices p and q, compress the pixels from position p to q by replacing all of them with their average value computed as $$\left\lfloor \frac{\sum_{i=p}^{q} pixels[i]}{q-p+1} \right\rfloor$$.
- Enhance: Given indices p, q and an integer k, update each pixel from position p to q by performing an integer division by k.
- Query: Output the maximum pixel intensity among all pixels at that moment.
Operations are given in the order they must be processed. Your task is to process all operations and for each query operation, output the result.
inputFormat
The input is given via standard input (stdin) in the following format:
- An integer
m
representing the number of pixels. m
space-separated integers representing the pixel intensity values.- An integer
n
representing the number of operations. n
subsequent lines, each representing an operation. Each line starts with an integer indicating the type of the operation:
- If the operation is
1
(compress), it is followed by two integersp
andq
. - If the operation is
2
(enhance), it is followed by three integersp
,q
andk
. - If the operation is
3
(query), there are no additional parameters.
outputFormat
For each query operation (operation type 3), output the maximum pixel intensity on a separate line to standard output (stdout).
## sample5
100 200 150 130 120
4
1 1 3
2 2 4 2
3
2 1 5 2
150
</p>