#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
74 ms |
7332 KB |
Output is correct |
4 |
Correct |
105 ms |
10700 KB |
Output is correct |
5 |
Correct |
120 ms |
10468 KB |
Output is correct |
6 |
Correct |
31 ms |
2516 KB |
Output is correct |
7 |
Correct |
38 ms |
5580 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
74 ms |
7332 KB |
Output is correct |
4 |
Correct |
105 ms |
10700 KB |
Output is correct |
5 |
Correct |
120 ms |
10468 KB |
Output is correct |
6 |
Correct |
31 ms |
2516 KB |
Output is correct |
7 |
Correct |
38 ms |
5580 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
97 ms |
12660 KB |
Output is correct |
10 |
Correct |
106 ms |
12700 KB |
Output is correct |
11 |
Correct |
118 ms |
12752 KB |
Output is correct |
12 |
Correct |
114 ms |
12440 KB |
Output is correct |
13 |
Correct |
44 ms |
8268 KB |
Output is correct |