#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int cnt[100010];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
int l,r,y;
cin>>l>>r>>y;
vector<pi>sv;
sv.eb(l,0);
sv.eb(r+1,0);
for(int i=0;i<n;i++)
{
int x,v,h;
cin>>x>>v>>h;
if(x-(y*h-1)/v>r)
continue;
if(x+(y*h-1)/v<l)
continue;
sv.eb(max(l,x-(y*h-1)/v),1);
sv.eb(min(r,x+(y*h-1)/v)+1,-1);
}
sort(all(sv));
int cc=0;
for(int i=1;i<(int)sv.size();i++)
{
cnt[cc]+=sv[i].fi-sv[i-1].fi;
cc+=sv[i].se;
}
for(int i=0;i<n;i++)
cnt[i+1]+=cnt[i];
for(int i=0;i<=n;i++)
cout<<cnt[i]<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
56 ms |
3560 KB |
Output is correct |
4 |
Correct |
55 ms |
3692 KB |
Output is correct |
5 |
Correct |
55 ms |
3560 KB |
Output is correct |
6 |
Correct |
40 ms |
3052 KB |
Output is correct |
7 |
Correct |
46 ms |
3688 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
56 ms |
3560 KB |
Output is correct |
4 |
Correct |
55 ms |
3692 KB |
Output is correct |
5 |
Correct |
55 ms |
3560 KB |
Output is correct |
6 |
Correct |
40 ms |
3052 KB |
Output is correct |
7 |
Correct |
46 ms |
3688 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
55 ms |
3948 KB |
Output is correct |
10 |
Correct |
68 ms |
3944 KB |
Output is correct |
11 |
Correct |
66 ms |
4080 KB |
Output is correct |
12 |
Correct |
57 ms |
3944 KB |
Output is correct |
13 |
Correct |
46 ms |
4072 KB |
Output is correct |