#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=1e5;
int n, a, b, y, ans[mxN+1];
ar<int, 2> e[2*mxN+1];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> a >> b >> y;
for (int i=0; i<n; ++i) {
ll x, v, h;
cin >> x >> v >> h;
ll w=(y*h-1)/v;
// [x-w, x+w]
int l=max((ll)a, x-w);
int r=min((ll)b, x+w);
e[2*i]={l, 1};
e[2*i+1]={r+1, -1};
}
sort(e, e+2*n);
e[2*n]={b+1, 0};
int last=a, cur=0;
for (int i=0; i<=2*n; ++i) {
int x=e[i][0], inc=e[i][1];
ans[cur]+=x-last, last=x, cur+=inc;
}
for (int i=0; i<=n; ++i) {
ans[i]+=i?ans[i-1]:0;
cout << ans[i] << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
60 ms |
4140 KB |
Output is correct |
4 |
Correct |
58 ms |
4420 KB |
Output is correct |
5 |
Correct |
58 ms |
4204 KB |
Output is correct |
6 |
Correct |
49 ms |
3652 KB |
Output is correct |
7 |
Correct |
50 ms |
3732 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
60 ms |
4140 KB |
Output is correct |
4 |
Correct |
58 ms |
4420 KB |
Output is correct |
5 |
Correct |
58 ms |
4204 KB |
Output is correct |
6 |
Correct |
49 ms |
3652 KB |
Output is correct |
7 |
Correct |
50 ms |
3732 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
60 ms |
4688 KB |
Output is correct |
10 |
Correct |
61 ms |
4876 KB |
Output is correct |
11 |
Correct |
60 ms |
4796 KB |
Output is correct |
12 |
Correct |
72 ms |
4768 KB |
Output is correct |
13 |
Correct |
52 ms |
4036 KB |
Output is correct |