Codeforces Round 178 (Div. 2)
A
Shaass and Oskols
Codeforces
800
原题
←B →
翻译中…

Shaass has decided to hunt some birds. There are $*n*$ horizontal electricity wires aligned parallel to each other. Wires are numbered $1$ to $*n*$ from top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of a delicious kind of birds in Shaass's territory. Supposed there are $*a*_{*i*}$ oskols sitting on the $*i*$-th wire.

翻译中…

image

翻译中…

Sometimes Shaass shots one of the birds and the bird dies (suppose that this bird sat at the $*i*$-th wire). Consequently all the birds on the $*i*$-th wire to the left of the dead bird get scared and jump up on the wire number $*i* - 1$, if there exists no upper wire they fly away. Also all the birds to the right of the dead bird jump down on wire number $*i* + 1$, if there exists no such wire they fly away.

翻译中…

Shaass has shot $*m*$ birds. You're given the initial number of birds on each wire, tell him how many birds are sitting on each wire after the shots.

翻译中…

Input

翻译中…

The first line of the input contains an integer $*n*$, $(1 ≤ *n* ≤ 100)$. The next line contains a list of space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$, $(0 ≤ *a*_{*i*} ≤ 100)$.

翻译中…

The third line contains an integer $*m*$, $(0 ≤ *m* ≤ 100)$. Each of the next $*m*$ lines contains two integers $*x*_{*i*}$ and $*y*_{*i*}$. The integers mean that for the $*i*$-th time Shaass shoot the $*y*_{*i*}$-th (from left) bird on the $*x*_{*i*}$-th wire, $(1 ≤ *x*_{*i*} ≤ *n*, 1 ≤ *y*_{*i*})$. It's guaranteed there will be at least $*y*_{*i*}$ birds on the $*x*_{*i*}$-th wire at that moment.

翻译中…

Output

翻译中…

On the $*i*$-th line of the output print the number of birds on the $*i*$-th wire.

翻译中…

样例

Input #1
5
10 10 10 10 10
5
2 5
3 13
2 12
1 13
4 6
Output #1
0
12
5
0
16
InputCopy OutputCopy
Input #2
3
2 4 1
1
2 2
Output #2
3
0
3
InputCopy OutputCopy
题目信息
题号
294A
时间限制
2 s
内存限制
256 MB
标签
模拟
数学

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