比赛 ZLXOI2015Day1 评测结果 WWWWWTWTTT
题目名称 虐狗大赛 最终得分 0
用户昵称 skik 运行时间 1.136 s
代码语言 C++ 内存使用 1.84 MiB
提交时间 2015-10-29 11:54:22
显示代码纯文本
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define maxn 100050
int n,q;
int H[maxn],B[maxn],sum1[maxn],sum2[maxn];
struct node{
	int l,r;
	int Hsum;
	bool lazy;
};
int getnum(){
	char c;int ans=0;
	c=getchar();
	while(c<='9'&&c>='0'){
		ans=ans*10+c-'0';
		c=getchar();
	}
	return ans;
}
void solve(int han){
	if(han){
		int nk=0,nsum=0;
		for(int i=1;i<=n;i++){
			nk+=sum2[i];
			nsum+=sum1[i];
			H[i]+=B[i]*nk-nsum;
			sum1[i]=0;sum2[i]=0;
			printf("%d ",H[i]);
		}
		sum1[0]=0;sum2[0]=0;
		printf("\n");
	}else{
		int a,b,c;
		a=getnum();
		b=getnum();
		c=getnum();
		sum1[a]+=c;sum2[a]++;
		sum1[b+1]+=-c;sum2[b+1]--;
	}
}
void read(){
	n=getnum();
	for(int i=1;i<=n;i++)H[i]=getnum();
	for(int i=1;i<=n;i++)B[i]=getnum();
	q=getnum();
	for(int i=1;i<=q;i++){
		int han=getnum();
		solve(han);
	}
}
int main(){
	freopen("thebigmatch.in","r",stdin);
	freopen("thebigmatch.out","w",stdout);
	read();
	return 0;
}