include[HTML_REMOVED]
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N];
//a[i]=b[1]+…+b[i];
int main()
{
int n, m;
scanf(“%d%d”, &n, &m);
for (int i = 1; i <= n; i)
{
scanf(“%d”, &a[i]);//已知a[],b是由a生成的,我们要对a数组进行l–r的加减操作
b[i] = a[i] - a[i - 1]; //构建差分数组
}
int l, r, c;
while (m–)
{
scanf(“%d%d%d”, &l, &r, &c);
b[l] += c; //将序列中[l, r]之间的每个数都加上c
//a[l]----a[n] +c
b[r + 1] -= c;
//a[l]—a[r] +c
}
for (int i = 1; i <= n; i)
{
a[i] = b[i] + a[i - 1]; //前缀和运算
printf(“%d “, a[i]);
}
return 0;
}