#C3745. Migration Bird Sanctuary Management
Migration Bird Sanctuary Management
Migration Bird Sanctuary Management
You are managing a migratory bird sanctuary consisting of several species. For each test case, you are given the initial populations of each species. You will be asked to process a sequence of operations:
U x y
- Update the population of species x by adding the integer y (note: indices are 1-indexed). This means the new population becomes: \(pop[x] = pop[x] + y\).Q x
- Query the current population of species x.
Process the queries in the given order and output the result for each query. The input starts with an integer T representing the number of test cases, followed by details of each test case.
inputFormat
The first line contains an integer T, the number of test cases. For each test case:
- A line with two integers N and Q, representing the number of species and the number of queries respectively.
- A line with N integers, where the i-th integer denotes the initial population of species i.
- Then follow Q lines, each being either:
U x y
for an update operation (add y to species x); orQ x
for a query operation (output the current population of species x).
outputFormat
For each query operation encountered in the order of input, output the current population of the specified species on a new line.
## sample1
3 5
10 20 30
U 2 5
Q 2
U 3 -10
Q 3
Q 1
25
20
10
</p>