#C12062. Array Element Multiplication
Array Element Multiplication
Array Element Multiplication
You are given an array of integers and a set of queries. Each query specifies a subarray defined by two indices l and r (inclusive) along with a multiplier m. For each query, you must multiply every element in the subarray by m.
Task: After performing all the queries sequentially, output the final form of the array.
Note: The indices are 0-based, and the queries should be executed in the order they are given.
Mathematically, for a query with parameters \( l, r, m \), update the array \( A \) as follows: \[ A[i] = A[i] \times m, \quad \text{for } l \le i \le r \]
inputFormat
The input is given in the following format:
N A[0] A[1] ... A[N-1] Q l1 r1 m1 l2 r2 m2 ... lQ rQ mQ
where:
N
is the number of elements in the array.- The next line contains
N
space-separated integers representing the array elements. Q
is the number of queries.- Each of the next
Q
lines contains three integersl, r, m
representing a query.
outputFormat
Print the modified array as a sequence of space-separated integers on one line. Ensure that there is a newline at the end.
## sample5
1 2 3 4 5
2
1 3 2
0 2 3
3 12 18 8 5
</p>