Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. //Alhamdulillah
  2. //Md. Masrur Saqib-RUET-1803
  3. //Created on 06-09-2019 11.30
  4.  
  5. #include<bits/stdc++.h>
  6. #define ll long long
  7. #define pb push_back
  8. #define dd double
  9. #define endl "\n"
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. ios_base::sync_with_stdio(false);
  16. cin.tie(NULL);
  17.  
  18. ll n, m,a,b,lar=0,k;
  19. cin >> n >> m;
  20. vector<ll> ara(n);
  21. for(ll i=0; i<m ; i++){
  22. cin >> a >> b >> k;
  23. a--;
  24. b--;
  25. for(ll j = a; j<=b ; j++){
  26. ara[j] += k;
  27. //cout << "hi" <<endl;
  28. }
  29. }
  30. for(ll i = 0; i<n ; i++){
  31. lar = (lar>ara[i])?lar:ara[i];
  32. }
  33. cout << lar << endl;
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement