fork download
  1. #include<bits/stdc++.h>
  2. #define IO ios_base::sync_with_stdio(),cin.tie(0),cout.tie(0) ;
  3. #define ll long long
  4. using namespace std;
  5. const int N = 1e5 + 4 ;
  6. int n , m , k , x , y ;
  7. ll a[N] , pre[N] , add[N] ;
  8. pair<pair<int , int> , int> p[N] ;
  9.  
  10. /// { {l , r} , d } >> p[1].first.first , p[1].first.second , p[1].second
  11. int main() {
  12. IO ;
  13. cin>>n>>m>>k ;
  14. for(int i = 1 ; i <= n ; i++)
  15. cin>>a[i] ;
  16. for(int i=1 ; i <= m ; i++)
  17. cin>>p[i].first.first>>p[i].first.second>>p[i].second ;
  18. while(k--)
  19. {
  20. cin>>x>>y ;
  21. pre[x]++ ;
  22. pre[y+1]-- ;
  23. }
  24. for(int i =1 ; i <= 1e5 ; i++)
  25. pre[i] += pre[i-1] ;
  26. for(int i=1 ; i <=m ; i++)
  27. {
  28. add[p[i].first.first] += pre[i] * p[i].second ;
  29. add[p[i].first.second+1] -= pre[i] * p[i].second ;
  30. }
  31. for(int i=1 ; i <= 1e5 ; i++)
  32. add[i] += add[i-1] ;
  33. for(int i=1 ; i <=n ; i++)
  34. cout<<a[i] + add[i]<<' ' ;
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5456KB
stdin
Standard input is empty
stdout
Standard output is empty