CF294A.Shaass and Oskols

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Shaass has decided to hunt some birds. There are nn horizontal electricity wires aligned parallel to each other. Wires are numbered 11 to nn 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 aia_{i} oskols sitting on the ii -th wire.

Sometimes Shaass shots one of the birds and the bird dies (suppose that this bird sat at the ii -th wire). Consequently all the birds on the ii -th wire to the left of the dead bird get scared and jump up on the wire number i1i-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+1i+1 , if there exists no such wire they fly away.

Shaass has shot mm 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.

输入格式

The first line of the input contains an integer nn , (1<=n<=100)(1<=n<=100) . The next line contains a list of space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} , (0<=ai<=100)(0<=a_{i}<=100) .

The third line contains an integer mm , (0<=m<=100)(0<=m<=100) . Each of the next mm lines contains two integers xix_{i} and yiy_{i} . The integers mean that for the ii -th time Shaass shoot the yiy_{i} -th (from left) bird on the xix_{i} -th wire, (1<=xi<=n,1<=yi)(1<=x_{i}<=n,1<=y_{i}) . It's guaranteed there will be at least yiy_{i} birds on the xix_{i} -th wire at that moment.

输出格式

On the ii -th line of the output print the number of birds on the ii -th wire.

输入输出样例

  • 输入#1

    5
    10 10 10 10 10
    5
    2 5
    3 13
    2 12
    1 13
    4 6
    

    输出#1

    0
    12
    5
    0
    16
    
  • 输入#2

    3
    2 4 1
    1
    2 2
    

    输出#2

    3
    0
    3
    
首页