#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
#define int long long
#define double long double
using namespace std;
const int mod=998244353,mxn=2e5+5,inf=1e18,minf=-1e18,lg=30;
//#undef int
int n,k,m,q;
void setIO(string name){
ios_base::sync_with_stdio(0); cin.tie(0);
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
struct line{
double m,c;
void init(int a,int b,int x){
m=(a*1.0/b);
c=m*(-x);
}
};
int32_t main(){
fastio
cin>>n;
int l,r,y;cin>>l>>r>>y;
line base;
base.m=0,base.c=y;
map<int,int>cnt;
cnt[r+1]=0;
for(int i=0;i<n;i++){
int x,a,b;cin>>x>>a>>b;
line p,q;
p.init(a,b,x),q.init(-a,b,x);
int pos=floor((base.c-q.c)*1.0/(q.m-base.m))+1,pos2=ceil((base.c-p.c)*1.0/(p.m-base.m));
cnt[pos]++;
cnt[pos2]--;
}
vector<int>ans(n+1,0);
int curcnt=0,last=l;
for(auto i:cnt){
if(i.f>l)ans[curcnt]+=abs(i.f-last);
if(i.f>r)break;
curcnt+=i.s;
last=i.f;
}
for(int i=0;i<=n;i++){
if(i)ans[i]+=ans[i-1];
cout<<ans[i]<<'\n';
}
}
/*
*/
Compilation message
Main.cpp:32:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
32 | #pragma GCC optimize ("03,unroll-lopps")
| ^
Main.cpp:39:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
39 | void setIO(string name){
| ^
Main.cpp:46:29: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
46 | void init(int a,int b,int x){
| ^
Main.cpp:51:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
51 | int32_t main(){
| ^
Main.cpp: In function 'void setIO(std::string)':
Main.cpp:41:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
41 | freopen((name+".in").c_str(),"r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:42:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
42 | freopen((name+".out").c_str(),"w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |