#include <iostream> #include <stdio.h> #include <map> #include <vector> #include <algorithm> #include <cstring> #include <iomanip> #include <string> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; const int MAXN = 1e+7; int arr[MAXN], tree[MAXN]; int n, m; int num[MAXN]; int lowbit(int k) { return k & (-k); } void add(int x, int k) { while (x <= n) { tree[x] += k; x += lowbit(x); } } int sum(int i) { int ret = 0; while (i > 0) { ret += tree[i]; i -= lowbit(i); } return ret; } int main() { scanf("%d%d", &n, &m); while (m--) { int a, b, c; cin >> a >> b >> c; add(a, c); add(b + 1, -c); } for (int i = 1; i <= n; i++) { printf("%d ", sum(i)); } return 0; }
0.0分
0 人评分