fork download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5. int main(void)
  6. {
  7. int n, m;
  8. int arr[101] = {0};
  9. int a, b, c;
  10. cin >> n >> m;
  11.  
  12. for(int i = 0; i < m; i++)
  13. {
  14. cin >> a >> b >> c;
  15. for(int k = a; k <= b; k++)
  16. arr[k] = c;
  17. }
  18.  
  19. for(int j = 1; j <= n; n++)
  20. cout << arr[j] << " ";
  21.  
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty