A8869 | Shaass and Oskols
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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.
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.
输出格式
On the $i$ -th line of the output print the number of birds on the $i$ -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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted