Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define loop(i,from,to) for (int i = from; i < to; ++i)
- #define qAll(q) q.begin(), q.end()
- #include <bits/stdc++.h>
- using std::cin;
- using std::cout;
- using std::endl;
- using std::vector;
- using std::string;
- using std::pair;
- using std::set;
- const int INF = 1e9+7;
- const double eps = 1e-6;
- template <typename T> void reverse(T &a) {
- long long s = a.size();
- for (long long i = 0; i < s / 2; ++i)
- std::swap(a[i], a[s - i - 1]);
- }
- signed main() {
- std::ios::sync_with_stdio(false);
- cin.tie(0);
- cout.tie();
- int n, l, r, v, t; cin >> n;
- vector< vector<int> > data(n);
- loop(i, 0, n) {
- cin >> l >> r >> v;
- data[i].emplace_back(l);
- data[i].emplace_back(r);
- data[i].emplace_back(v);
- }
- cin >> t;
- vector<int> timeline(t, 0);
- std::sort(data.begin(), data.end());
- loop(i, 0, n)
- loop(j, data[i][0], t - 1) {
- if (j > data[i][1]) break;
- timeline[j] += data[i][2];
- }
- cout << timeline[t - 1];
- //std::cout << "Hello World!\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement