QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 512 MB مجموع النقاط: 100

#7438. Higuchi Madoka

الإحصائيات

Given two sequences $a_1, \dots, a_n$ and $b_1, \dots, b_n$, where initially $b_i = 0$.

You need to perform $m$ operations:

In each operation, you are given $l, r, L$. For each $k \in [l, r]$, you must add $a_k$ to $b_{L+k-l}$.

Finally, output the sequence $b_1, \dots, b_n$ after all operations.

Input

The first line contains an integer $n$.

The second line contains $n$ integers $a_1, \dots, a_n$.

The third line contains an integer $m$.

The following $m$ lines each contain three integers $l, r, L$, representing an operation.

Output

Output $n$ lines, representing the sequence $b_1, \dots, b_n$ after the operations.

Examples

Input 1

3
1 2 3
1
1 2 2

Output 1

0
1
2

Subtasks

Idea: nzhtl1477, Solution: ccz181078, Code: ccz181078, Data: ccz181078

For $100\%$ of the data, $0 \le a_i \le 1000$, $1 \le n \le 10^5$, and $1 \le m \le 10^6$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.