根据题目描述计算,注意题目没给t的范围即可。

#include <iostream>
#include<vector>
using namespace std;
using ll=long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    ll t;
    int a, b;
    cin >> n >> t >> a >> b;
    vector<ll> time(n), diff(n);
    for(int i = 0; i < n; i++) cin >> time[i];
    for(int i = 0; i < n; i++) cin >> diff[i];
    ll t1 = t, t2 = t;
    int ans1 = 0, ans2 = 0;
    for(int i = 0; i < n; i++){
        if(diff[i] < a){
            if(t1 >= time[i]){
                t1 -= time[i];
                ans1++;
            }
        }
        if(diff[i] >= b){
            if(t2 >= time[i] * 2){
                t2 -= time[i] * 2;
                ans2++;
            }
        }
        else {
            if(t2 >= time[i]){
                t2 -= time[i];
                ans2++;
            }
        }
    }
    cout << ans1 << " " << ans2 << "\n";
    return 0;
}