WA #10 求条
#include <cstdio>
#include <cstring>
int n, m;
int d[500000];
int main(void)
{
scanf("%d %d", &n, &m);
for (int i = 0; i < m; i++)
{
int l, r, h;
scanf("%d %d %d", &l, &r, &h);
d[l] += h;
d[r + 1] -= h;
}
for (int i = 1; i <= n; i++)
{
d[i] = d[i] + d[i - 1];
printf("%d ", d[i]);
}
return 0;
}
