题解:P14129 [SCCPC 2021] True Story

· · 题解

P14129 [SCCPC 2021] True Story题解

这题其实并不难,只需要理解题意就行啦~~~

#include <iostream>
using namespace std;
const int N=1e5+10;
long long n,k,l,f,t[N],p[N],y[N],ans;
int main() {
    cin>>n>>k>>l>>f;
    int s;
    for(int i=1;i<=n;++i){
        cin>>s;
        t[i]=l/s;
        if(l%s!=0){
            t[i]++;
        }
    }
    for(int i=1;i<=k;++i){
        cin>>y[i];
    }
    for(int i=1;i<=k;++i){
        cin>>p[i];
    }
    y[0]=0;
    p[0]=f;
    long long mx=0;
    for(int i=0;i<=k;++i){
        mx=max(mx,p[i]-y[i]);
    }
    for(int i=1;i<=n;++i){
        if(t[i]<=mx)ans++;
    }cout<<ans;
    return 0;
}