提交时间:2024-01-21 12:01:23

运行 ID: 37519

#include <bits/stdc++.h> using namespace std; int a[260], b[260]; int main(){ int n, m; cin >> n >> m; for (int i = 1; i <= n; ++ i) cin >> a[i]; while (m--){ int l, r, c; cin >> l >> r >> c; b[l] += c; b[r + 1] -= c; } for (int i = 1; i <= n; ++ i){ b[i]+= b[i - 1]; a[i] += b[i]; cout << a[i] << " "; } return 0; }