#C11768. Taco - Operations on a List
Taco - Operations on a List
Taco - Operations on a List
You are given an integer n and an initial list B of length n where each element is initialized to 1. You are also given a series of m operations. Each operation is of one of the following two types:
0 i x
: Multiply the i-th element of the list (1-indexed) by x.1 s t
: Compute the product of elements from index s to t (both inclusive) and output the result.
All product operations should be computed exactly. Formally, if the list is \(B = [B_1, B_2, \ldots, B_n]\), then for a query operation 1 s t
, you should output
\[
\prod_{i=s}^{t} B_i
\]
Input/Output Method: Read the input from standard input (stdin) and write the result to standard output (stdout).
inputFormat
The first line contains two integers n and m, the number of elements in the list and the number of operations, respectively.
The following m lines each contain an operation in the format:
0 i x
for the multiplication operation.1 s t
for the product query.
Indices are 1-based.
outputFormat
For each operation of type 1 s t
, output the product of elements from index s to t on a new line.
4 4
0 1 2
0 3 4
1 1 3
1 3 4
8
4
</p>