#include <bits/stdc++.h>
using namespace std;
#define oo 1e18
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
#define _cos(xxxx) cos(xxxx*acos(-1)/180)
#define _sin(xxxx) sin(xxxx*acos(-1)/180)
#define _tan(xxxx) tan(xxxx*acos(-1)/180)
#define PE cout<<fixed
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
const ld pi=acos(-1);
ll n,l,r,y,i,x,v,h,pl,pr,sl,last,cur,res[500009],ans[500009];
pll a[500009];
int main() {
IO;
cin>>n;
cin>>l>>r>>y;
for (i=1;i<=n;i++) {
cin>>x>>v>>h;
pl=x+ceil((-(((ld)h)*((ld)y))/((ld)v)));
pr=x+floor(((((ld)h)*((ld)y))/((ld)v)));
if ((h*y)%v==0) {
pl++;
pr--;
}
//cout<<pl<<' '<<pr<<' '<<((ld)(-(((ld)h)*((ld)y))/((ld)v)))<<' '<<((ld)((((ld)h)*((ld)y))/((ld)v)))<<'\n';
a[i*2-1]={pl,1};
a[i*2]={pr+1,-1};
}
sort(a+1,a+n+n+1);
last=l;
cur=0;
for (i=1;i<=2*n;i++) {
res[cur]+=max(a[i].fi-last,i-i);
cur+=a[i].se;
last=max(last,min(a[i].fi,r));
}
ans[n]=(r-l)+1;
for (i=n-1;i>=0;i--) {
ans[i]=ans[i+1]-res[i+1];
}
for (i=0;i<=n;i++) {
cout<<ans[i]<<'\n';
}
/*
cout<<'\n';
for (i=1;i<=2*n;i++) {
cout<<a[i].fi<<' ';
}
cout<<'\n';
for (i=1;i<=2*n;i++) {
cout<<a[i].se<<' ';
}
*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |