#C4680. Performing Array Queries
Performing Array Queries
Performing Array Queries
In this problem, you are given an array (b) of length (m). You need to process (q) queries on the array. There are three types of queries:
- Type 1: Queries of the form "1 j y". Increase the \(j\)-th element (i.e., \(b_j = b_j + y\)) and then print the updated array.
- Type 2: Queries of the form "2 y". Multiply every element by \(y\) (i.e., \(b_i = b_i \times y\) for all \(i\)) and then print the updated array.
- Type 3: Query "3". Print the maximum element in the array.
Note that the parameter \(p\) is provided as input but is not used in processing the queries. For each query, output the result immediately on a new line. For type 1 and type 2 queries, the entire array (with values separated by a single space) should be printed, and for type 3 queries a single integer (the maximum value) should be printed.
inputFormat
Input is read from standard input (stdin). The first line contains two integers (m) and (p). The second line contains (m) space-separated integers representing the array (b). The third line contains an integer (q), denoting the number of queries. Each of the following (q) lines contains a query in one of the following formats:
- For query type 1: `1 j y`
- For query type 2: `2 y`
- For query type 3: `3`
outputFormat
Output should be written to standard output (stdout). For each query, output the result on a separate line. For queries of type 1 and type 2, output the updated array (space-separated). For queries of type 3, output a single integer representing the maximum element in the array.## sample
4 5
1 3 2 4
5
1 2 3
2 2
3
1 4 5
3
1 6 2 4
2 12 4 8
12
2 12 4 13
13
</p>