#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int a[105];
int main()
{
int n, m, x, y, right, left;
int i, j;
while(scanf("%d", &n)==1)
{
for(i=1; i<=n; i++)
{
scanf("%d", &a[i]);
}
scanf("%d", &m);
for(j=1; j<=m; j++)
{
scanf("%d%d", &x, &y);
if( (x+1) <=n )
{
right = a[x]-y;
a[x+1] = a[x+1] + right;
}
if( (x-1)>=1)
{
left = y-1;
a[x-1] = a[x-1]+left;
}
a[x] = 0;
}
for(i=1; i<=n; i++)
{
printf("%d\n", a[i]);
}
}
}
No comments:
Post a Comment