显示代码纯文本
#include<cstdio>
using namespace std;
const int SIZEN=100100;
int N;
int H[SIZEN]={0};
int D[SIZEN]={0};
int P[SIZEN]={0},pos[SIZEN]={0};
int q;
void read()
{
scanf("%d",&N);
for(int i=1;i<=N;i++) scanf("%d",&H[i]);
for(int i=1;i<=N;i++) scanf("%d",&D[i]);
}
void add(int a,int b,int c)
{
P[a]++;P[b+1]--;
pos[a]+=c;pos[b+1]-=c;
}
void out()
{
int tem=0,sum=0;
for(int i=1;i<=N;i++)
{
tem+=pos[i];
sum+=P[i];
int ans=H[i]-tem+sum*D[i];
printf("%d ",ans);
}
printf("\n");
}
void work()
{
int cmd;
scanf("%d",&q);
int a,b,c;
for(int i=1;i<=q;i++)
{
scanf("%d",&cmd);
if(cmd==0)
{
scanf("%d%d%d",&a,&b,&c);
add(a,b,c);
}
else out();
}
}
int main()
{
freopen("thebigmatch.in","r",stdin);
freopen("thebigmatch.out","w",stdout);
read();
work();
return 0;
}