比赛 板子大赛 评测结果 WWWWWWWWWW
题目名称 区间修改 最终得分 0
用户昵称 喵喵喵 运行时间 1.205 s
代码语言 C++ 内存使用 3.62 MiB
提交时间 2025-01-22 10:39:45
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
__int128_t a[10005],b[10005];
int m,n;
void fast_read(int ind)
{
	char ch[100005];
	cin >> ch;
	for(int i = 0;i < strlen(ch);i++)
	{
		a[ind] *= 10;
		a[ind] += ch[i] - '0';
	}
}
int main()
{
	freopen("interval_mod.in","r",stdin);
	freopen("interval_mod.out","w",stdout);
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		fast_read(i);
		b[i] = a[i] - a[i-1];
	}
	cin >> m;
	for(int i = 0;i < m;i++)
	{
		int l,r,x;
		cin >> l >> r >> x;
		if(x == 0) continue;
		else b[l] += x,b[r+1] -= x;
	}
	int now = 0;
	for(int i = 1;i <= n;i++)
	{
		now += b[i];
		cout << now << " ";
	}
	cout << endl;
	return 0;
}