Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
36013 | 武云帆 | 【S】T1 | C++ | 解答错误 | 90 | 288 MS | 8068 KB | 1172 | 2025-02-07 14:08:49 |
#include<bits/stdc++.h> using namespace std; long long n,Q,L,R; const int N=2e5+10; long long a[N]; int ans=0; struct node{ long long q,x,s,t; }c[N]; long long trunc(long long x,long long s,long long t){ return (x-s)/t*1ll; } long long solve(int k){ for(int i=1;i<=Q;i++){ if(c[i].q==1&&c[i].x<=k) k=(k+c[i].s)*c[i].t; if(c[i].q==2&&c[i].x>=k) k=trunc(k,c[i].s,c[i].t); } return k; } int main(){ //freopen("arithmetic3.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>>c[i].q>>c[i].x>>c[i].s>>c[i].t; } sort(a+1,a+1+n); a[0]=a[1]; a[n+1]=a[n]; int l=1,r=n; while(l<r){ int mid=(l+r)/2; long long p=solve(a[mid]); if(p<L) l=mid+1; else r=mid; } int q1=l; l=1,r=n; while(l<r){ int mid=(l+r)/2; long long p=solve(a[mid]); if(p>=R) r=mid; else l=mid+1; } if(solve(a[q1])>R||solve(a[r])<L) cout<<0<<endl; else cout<<r-q1+1<<endl; return 0; }