electicode
HomeCoursesResourcesProblemsNational OlympiadContestsLeaderboard
...

Array queries

Time Limit: 1000msMemory Limit: 256MB
View Submissions

Problem Description

Given an array of integers of length nnn, initially all elements are equal to xxx. There are qqq queries. Each query has the form: ttt, iii, kkk. Perform the following actions:

  • If t=1t = 1t=1, assign the value kkk to the iii-th element of the array.
  • If t=2t = 2t=2, increase the value of the iii-th element by kkk.

Output the resulting array after executing all queries.

Input Format

In the first line of output data, three integers are written: nnn, xxx, and qqq, where 1≤n,q≤2⋅1051 \le n, q \le 2 \cdot 10^{5}1≤n,q≤2⋅105, and .

In the following qqq lines, three integers ttt, iii, and kkk are written for each query, where 1≤t≤21 \le t \le 21≤t≤2, 1≤i≤n1 \le i \le n1, and .

Output Format

Output the resulting array.

Examples

Example 1
Input
3 2 4
1 1 15
1 3 3
2 1 5
2 3 2
Output
20 2 5

© 2026 Electicode. All rights reserved.

1≤x≤1091 \le x \le 10^{9}1≤x≤109
≤
i≤
n
1≤k≤1091 \le k \le 10^{9}1≤k≤109