Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #define ll long long
- using namespace std;
- int main()
- {
- ll int cant, act, maximo = 0, t = 0;
- cin >> cant >> act;
- vector <ll int> n(cant + 1);
- for(ll int i = 0; i < act; i++){
- ll int d, h, k;
- cin >> d >> h >> k;
- n[d] += k;
- n[h + 1] -= k;
- }
- for(ll int i = 1; i <= cant; i++)
- t += n[i], maximo = max(maximo, t);
- cout << maximo << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement