sub15 @ 2023-11-14 21:52:32
#include <bits/stdc++.h>
using namespace std;
int n,x;
int chair,arm;
int ans = 0;
struct tt{
int gd;
int shlq;
}aple[10000];
bool cmp(tt a,tt b){
a.gd < b.gd && a.shlq < b.shlq;
}
int main(){
cin >> n >> x;
cin >> arm >> chair;
for(int i = 1;i <= n;i++){
cin >> aple[i].gd >> aple[i].shlq;
}
sort(aple + 1,aple + n + 1,cmp);
for(int i = 1;i <= n;i++){
if(arm + chair >= aple[i].gd && x >= aple[i].shlq){
ans++;
x -= aple[i].shlq;
}
}
cout << ans;
return 0;
}
by happy_guest @ 2023-11-14 22:00:13
救急,我也 只有 40pts