#K74642. Gaming System Score Management
Gaming System Score Management
Gaming System Score Management
You are given a gaming system that tracks the scores of players. Initially, you are provided with the scores of all players. After that, you need to process a number of queries. There are two types of queries:
1 x v
: Update the score of the player at the 1-indexed positionx
tov
.2 l r
: Compute the sum of scores for all players from positionl
tor
(inclusive). The summation can be represented using the formula: $$ S = \sum_{i=l}^{r}{score_i} $$.
You must process the queries in the given order and output the result for every query of type 2.
inputFormat
The input is given as follows:
- An integer
n
representing the number of players. - A line with
n
space‐separated integers where each integer represents the initial score of a player. - An integer
q
representing the number of queries. q
lines each containing a query in one of the two formats described above.
outputFormat
For each query of type 2, output the resulting sum on a new line.
## sample5
10 20 30 40 50
3
1 3 35
2 2 4
2 1 5
95
155
</p>