Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
36168 | j136 | 【S】T1 | C++ | 解答错误 | 90 | 184 MS | 8100 KB | 933 | 2025-02-07 20:30:54 |
#include<bits/stdc++.h> using namespace std; long long n,qs,l,r,m,tgtl,tgtr,q[229028],x[229028],s[229028],t[229028],a[229028],ans; void out(){ for(int i=1;i<=n;i++)cout<<a[i]<<' '; cout<<'\n'; } int tr(double x){ if(x<0)return -tr(-x); return floor(x); } int cal(int a){ for(int i=1;i<=qs;i++){ if(q[i]==1&&a>=x[i])a=t[i]*(a+s[i]); if(q[i]==2&&a<=x[i])a=tr((a-s[i])/t[i]); } } int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>n>>qs>>tgtl>>tgtr; for(int i=1;i<=n;i++)cin>>a[i]; for(int i=1;i<=qs;i++)cin>>q[i]>>x[i]>>s[i]>>t[i]; sort(a+1,a+n+1); l=1,r=n+1; while(l<r){ ans=(l+r)/2; if(cal(a[ans])>=tgtl)r=ans; else l=ans+1; } ans=l,l=0,r=n; while(l<r){ m=(l+r+1)/2; if(cal(a[m])<=tgtr)l=m; else r=m-1; } cout<<max(0ll,l-ans+1); return 0; }