/**
____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N_MAX = 100002;
const double EPS = 1e-10;
int n;
ll L, R, Y;
long double getx (ll v, ll h, ll x)
{
return x + (long double)Y * h / v;
}
map <ll, int> mp;
ll ans[N_MAX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
cin >> L >> R >> Y;
for(int i = 1; i <= n; i++)
{
ll v, h, x;
cin >> x >> v >> h;
ll l = ceil(getx(-v, h, x) + EPS);
ll r = floor(getx(v, h, x) - EPS);
l = max(L, l);
r = min(R, r);
mp[l]++;
mp[r + 1]--;
}
mp[R + 1];
ll last = L;
int cnt = 0;
for(pair <ll, int> p : mp)
{
ans[cnt] += p.first - last;
cnt += p.second;
last = p.first;
}
for(int i = 1; i <= n; i++)
ans[i] += ans[i - 1];
for(int i = 0; i <= n; i++)
cout << ans[i] << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
132 ms |
8172 KB |
Output is correct |
4 |
Correct |
174 ms |
12524 KB |
Output is correct |
5 |
Correct |
201 ms |
12268 KB |
Output is correct |
6 |
Correct |
61 ms |
1940 KB |
Output is correct |
7 |
Correct |
74 ms |
6380 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
132 ms |
8172 KB |
Output is correct |
4 |
Correct |
174 ms |
12524 KB |
Output is correct |
5 |
Correct |
201 ms |
12268 KB |
Output is correct |
6 |
Correct |
61 ms |
1940 KB |
Output is correct |
7 |
Correct |
74 ms |
6380 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
9 |
Correct |
165 ms |
14700 KB |
Output is correct |
10 |
Correct |
169 ms |
16364 KB |
Output is correct |
11 |
Correct |
167 ms |
16364 KB |
Output is correct |
12 |
Correct |
234 ms |
16020 KB |
Output is correct |
13 |
Correct |
81 ms |
10604 KB |
Output is correct |