3 条题解
-
0
cpp #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 200005; ll diff[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; if (!(cin >> n >> m)) return 0; for (int i = 0; i < m; ++i) { int l, r, v; cin >> l >> r >> v; diff[l] += v; diff[r + 1] -= v; } ll current_seats = 0; for (int i = 1; i <= n; ++i) { current_seats += diff[i]; cout << current_seats << (i == n ? "" : " "); } cout << "\n"; return 0; }
信息
- ID
- 19324
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- 10
- 标签
- (无)
- 递交数
- 3
- 已通过
- 3
- 上传者