Codeforces Round 179 (Div. 1)
A
Greg and Array
Codeforces
1400
原题
←B →
翻译中…

Greg has an array $*a* = *a*_{1}, *a*_{2}, ..., *a*_{*n*}$ and $*m*$ operations. Each operation looks as: $*l*_{*i*}$, $*r*_{*i*}$, $*d*_{*i*}$, $(1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ *n*)$. To apply operation $*i*$ to the array means to increase all array elements with numbers $*l*_{*i*}, *l*_{*i*} + 1, ..., *r*_{*i*}$ by value $*d*_{*i*}$.

翻译中…

Greg wrote down $*k*$ queries on a piece of paper. Each query has the following form: $*x*_{*i*}$, $*y*_{*i*}$, $(1 ≤ *x*_{*i*} ≤ *y*_{*i*} ≤ *m*)$. That means that one should apply operations with numbers $*x*_{*i*}, *x*_{*i*} + 1, ..., *y*_{*i*}$ to the array.

翻译中…

Now Greg is wondering, what the array $*a*$ will be after all the queries are executed. Help Greg.

翻译中…

Input

翻译中…

The first line contains integers $*n*$, $*m*$, $*k*$ $(1 ≤ *n*, *m*, *k* ≤ 10^{5})$. The second line contains $*n*$ integers: $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(0 ≤ *a*_{*i*} ≤ 10^{5})$ — the initial array.

翻译中…

Next $*m*$ lines contain operations, the operation number $*i*$ is written as three integers: $*l*_{*i*}$, $*r*_{*i*}$, $*d*_{*i*}$, $(1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ *n*)$, $(0 ≤ *d*_{*i*} ≤ 10^{5})$.

翻译中…

Next $*k*$ lines contain the queries, the query number $*i*$ is written as two integers: $*x*_{*i*}$, $*y*_{*i*}$, $(1 ≤ *x*_{*i*} ≤ *y*_{*i*} ≤ *m*)$.

翻译中…

The numbers in the lines are separated by single spaces.

翻译中…

Output

翻译中…

On a single line print $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ — the array after executing all the queries. Separate the printed numbers by spaces.

翻译中…

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.

翻译中…

样例

Input #1
3 3 3
1 2 3
1 2 1
1 3 2
2 3 4
1 2
1 3
2 3
Output #1
9 18 17
InputCopy OutputCopy
Input #2
1 1 1
1
1 1 1
1 1
Output #2
2
InputCopy OutputCopy
Input #3
4 3 6
1 2 3 4
1 2 1
2 3 2
3 4 4
1 2
1 3
2 3
1 2
1 3
2 3
Output #3
5 18 31 20
InputCopy OutputCopy
题目信息
题号
295A
时间限制
1.5 s
内存限制
256 MB
标签
数据结构
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。