smoothie-web Problems Contests Ranking About
Login Register

BSSPC 2020 P10 - nani

data_usage Points
1
timer Time Limit
linear_scale Memory Limit
Created
1588858953670

Problem Statement

Suppose you're given an array of size NN (1N1051\leq N\leq 10^5). This array contains integers a1,,aNa_1,\ldots,a_N, where the elements satisfy 0<ai<1090<a_i<10^9 for each ii. For each aia_i, its initial value is 11.

You need to answer QQ queries in total, where 1Q1051\leq Q\leq 10^5. There are two types of queries:

Input Specification

The first line contains the integers NN and QQ, separated by a space.

On each of the next QQ lines are one query each, following the format above.

Output Specification

For each query with type query, print the result on its own line.

Sample 1

Input:

5 6
update 1 14
update 2 9
query 1 5
update 4 11
query 2 4

Output:

6
9
Query Array Output
update 1 14 [14, 1, 1, 1, 1]
update 2 9 [14, 9, 1, 1, 1]
query 1 5 [14, 9, 1, 1, 1] The output should be (14×9) mod 10=6(14\times 9) \text{ mod } 10=6
update 4 11 [14, 9, 1, 11, 1]
query 2 4 [14, 9, 1, 11, 1] The output should be (9×11) mod 10=9(9\times 11)\text{ mod } 10=9

Sample 2

Input:

6 7
update 1 5
update 2 2
update 3 3
update 4 4
query 2 4
query 3 5
query 1 5

Output:

4
2
0

We can, again, trace the values in the array:

Query Array Output
update 1 5 [5, 1, 1, 1, 1, 1]
update 2 2 [5, 2, 1, 1, 1, 1]
update 3 3 [5, 2, 3, 1, 1, 1]
update 4 4 [5, 2, 3, 4, 1, 1]
query 2 4 [5, 2, 3, 4, 1, 1] (2×3×4) mod 10=4(2\times 3\times 4)\text{ mod }10=4
query 3 5 [5, 2, 3, 4, 1, 1] (3×4×1) mod 10=2(3\times 4\times 1)\text{ mod }10=2
query 1 5 [5, 2, 3, 4, 1, 1] (5×2×3×4×1) mod 10=0(5\times 2\times 3\times 4\times 1)\text{ mod }10=0