1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <iostream> using namespace std; int main() { int N = 0, M = 0, i, j, k; cin >> N >> M; int* arr = new int[N](); for (int m = 0; m < M; m++) { cin >> i >> j >> k; for (int n = i – 1; n < j; n++) { arr[n] = k; } } for (int m = 0; m < N; m++) { cout << arr[m] << ‘ ‘; } return 0; } | cs |