405226: GYM101853 A Zero Array

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Zero Arraytime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given an array a consisting of n elements, and q queries. There are two types of queries, as follow:

  • "1 p v" – An update query asks to change the value at position p in array a to v.
  • "2" – A query asks to print the minimum number of required operations to convert array a to a zero array.

A zero array is defined as an array which all its elements are zeros. There is only one allowed operation to convert an array to a zero array. At each operation, you can choose a value x and subtract it from all non-zero elements in the array, such that no element will be negative after the operation.

Input

The first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.

The first line of each test case consists of two integers n and q (1 ≤ n, q ≤ 105), in which n is the size of the array a, and q is the number of queries.

Then a line follows containing n elements a1, a2, ..., an (0 ≤ ai ≤ 109), giving the array a.

Then q lines follow, each line containing a query in the format described in the problem statement. It is guaranteed that the following constraints hold for the first type of queries: 1 ≤ p ≤ n, 0 ≤ v ≤ 109.

The sum of n and q overall test cases does not exceed 106 for each.

Output

For each query of the second type, print the minimum number of required operations to convert array a to a zero array. The queries must be answered in the order given in the input.

ExampleInput
1
5 5
3 2 1 5 4
1 2 3
2
1 3 2
1 4 1
2
Output
4
4

加入题单

算法标签: