This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, L, R, Y;
cin >> n >> L >> R >> Y;
map<int, int> mp;
for (int i = 0, x, v, h; i < n; i++) {
cin >> x >> v >> h;
int l = max(1LL * L, x - (1LL * h * Y - 1) / v);
int r = min(1LL * R, x + (1LL * h * Y - 1) / v);
mp[l]++, mp[r + 1]--;
}
vector<int> res(n + 1);
int lst = L, cur = 0;
for (auto &p : mp) {
res[cur] += p.first - lst;
cur += p.second, lst = p.first;
}
res[cur] += R + 1 - lst;
for (int i = 0; i <= n; i++) {
if (i) res[i] += res[i - 1];
cout << res[i] << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |