Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
786 B
0
Indexable
Never
#pragma GCC optimize("O2,no-stack-protector,unroll-loops")
#define ll long long
#define pb push_back
#define ipar(arr, n) vector<ll> arr(n); for(int i=0;i<n;i++) cin>>arr[i];
#include <cmath>
#include <bits/stdc++.h>
#define pii pair<int, int>;
#define pll pair<ll, ll>;
using namespace std;


void solve(){
    ll n,w,wr;cin>>n>>w>>wr;
    ipar(arr,n);
    unordered_map<ll,ll>mp;
     for(auto i:arr) mp[i]++;
    
    ll res=wr;
    for(auto i:mp){
        if(i.second%2==0) res+=i.first*i.second;
        else res+=i.first*(i.second-1);
    }
    //cout<<res<<"\n";
    
    if(res>=w){
        cout<<"YES"<<"\n";
    }else{
        cout<<"NO"<<"\n";
    }
}


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t;
	cin>>t;
	while(t--) solve();
}
Leave a Comment