CF294A.Shaass and Oskols

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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.

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.

沙赫斯决定猎杀一些鸟。有 nn 根水平的电线彼此平行排列。电线从上到下依次编号为 11 到 nn。每根电线上都有一些相邻而坐的“奥斯科尔鸟”(oskol)——这是沙赫斯领地内一种美味的鸟类。假设第 ii 根电线上有 aia_i 只奥斯科尔鸟。

有时沙赫斯会射中其中一只鸟(假设该鸟位于第 ii 根电线上),这只鸟随即死亡。于是,第 ii 根电线上所有位于该死鸟左侧的鸟都会受惊,向上飞至第 i−1i-1 根电线;若不存在上方的电线(即 i=1i = 1),则它们直接飞走。同样地,所有位于该死鸟右侧的鸟都会向下飞至第 i+1i+1 根电线;若不存在下方的电线(即 i=ni = n),则它们也直接飞走。

沙赫斯共射杀了 mm 只鸟。已知每根电线初始的鸟的数量,请你计算并输出所有射击结束后,每根电线上剩余的鸟的数量。

输入格式

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.

输入的第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)。第二行包含 nn 个由空格分隔的整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n(0≤ai≤1000 \leq a_i \leq 100)。

第三行包含一个整数 mm(0≤m≤1000 \leq m \leq 100)。接下来的 mm 行,每行包含两个整数 xix_i 和 yiy_i。这些整数表示:第 ii 次射击时,Shaass 射击第 xix_i 根电线上从左往右数第 yiy_i 只鸟(1≤xi≤n1 \leq x_i \leq n,1≤yi1 \leq y_i)。保证在该时刻第 xix_i 根电线上至少有 yiy_i 只鸟。

输出格式

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

在输出的第 ii 行打印第 ii 根电线上鸟的数量。

输入输出样例

  • 输入#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

输入解题思路,AI测评打分。不知道怎么写?

首页