#P8527. [Ynoi2003] 樋口円香

[Ynoi2003] 樋口円香

Description

Given two sequences a1,,ana_1,\dots,a_n and b1,,bnb_1,\dots,b_n, initially bi=0b_i=0.

You need to perform mm operations.

In each operation, you are given l,r,Ll,r,L. For k[l,r]k\in[l,r], increase bL+klb_{L+k-l} by aka_k.

Finally, output the sequence b1,,bnb_1,\dots,b_n after all operations.

Input Format

The first line contains an integer nn.

The second line contains nn integers a1,,ana_1,\dots,a_n.

The third line contains an integer mm.

Then follow mm lines, each with three integers l  r  Ll\;r\;L, representing a query.

Output Format

Output nn lines, representing b1,,bnb_1,\dots,b_n after the operations.

3
1 2 3
1
1 2 2
0
1
2

Hint

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

For 100%100\% of the testdata, 0ai10000\le a_i\le 1000, 1n1051\le n\le 10^5, and 1m1061\le m\le 10^6.

Translated by ChatGPT 5