Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
35998 | A21μΘ_wjy | 【S】T1 | C++ | 解答错误 | 10 | 240 MS | 8064 KB | 1264 | 2025-02-07 13:57:14 |
#include<bits/stdc++.h> #define int long long #define doub long double using namespace std; const int maxn=2e5+7; int n,q,L,R; int a[maxn]; int truncc(doub x){ return x<0?ceill(x):floorl(x); } inline void Q1(int x,int s,int t){ for(int i=1;i<=n;i++)if(a[i]>=x)a[i]=t*(a[i]+s); } inline void Q2(int x,int s,int t){ for(int i=1;i<=n;i++)if(a[i]<=x)a[i]=truncc(1.0L*(a[i]-s)/(1.0L*t)); } int op[maxn],x[maxn],s[maxn],t[maxn]; int LB=-(1ll<<63),RB=(1ll<<63); inline int F(int d){ for(int i=1;i<=q;i++){ if(op[i]==1)if(d>=x[i])d=t[i]*(d+s[i]); else if(d<=x[i])d=truncc(1.0L*(d-s[i])/(1.0L*t[i])); } } signed main(){ // freopen("arithmetic.in","r",stdin); // freopen("arithmetic.out","w",stdout); cin>>n>>q>>L>>R; for(int i=1;i<=n;i++)cin>>a[i]; for(int i=1;i<=q;i++)cin>>op[i]>>x[i]>>s[i]>>t[i]; int l=LB,r=RB; int GL,GR; while(l<r){ int mid=l+r+1>>1; if(F(mid)>=L)l=mid; else r=mid-1; } GL=l; l=LB,r=RB; while(l<r){ int mid=l+r>>1; if(F(mid)<=R)r=mid; else l=mid+1; } GR=r; int cnt=0; for(int i=1;i<=n;i++)if(GL<=a[i]&&a[i]<=GR)++cnt; cout<<cnt<<endl; return 0; }