結果
| 問題 | 
                            No.1015 おつりは要らないです
                             | 
                    
| コンテスト | |
| ユーザー | 
                             divinediscon10t
                         | 
                    
| 提出日時 | 2020-04-05 02:28:48 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,291 bytes | 
| コンパイル時間 | 1,486 ms | 
| コンパイル使用メモリ | 171,296 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-03 07:55:51 | 
| 合計ジャッジ時間 | 3,180 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 15 WA * 18 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;
int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, x, y, z; cin >> n >> x >> y >> z;
	ll a[n]; zep(i, 0, n){cin >> a[i];}
	
	ll man = 10000;
	ll go = 5000;
	ll sen = 1000;
	zep(i, 0, n){
		if(a[i] >= man){
			ll buf = min(x, a[i]/man);
			a[i] -= buf*man;
			x -= buf;
		}
	}
	sort(a, a+n);
	rrep(i, n-1, 0){
		if(x > 0 && a[i] >= 0){
			a[i] -= man;
			x--;
		}
	}
	zep(i, 0, n){
		if(a[i] >= go){
			ll buf = min(y, a[i]/go);
			a[i] -= buf*go;
			y -= buf;
		}
	}
	sort(a, a+n);
	rrep(i, n-1, 0){
		if(y > 0 && a[i] >= 0){
			a[i] -= go;
			y--;
		}
	}
	zep(i, 0, n){
		if(a[i] >= sen){
			ll buf = min(z, a[i]/sen);
			a[i] -= buf*sen;
			z -= buf;
		}
	}
	sort(a, a+n);
	rrep(i, n-1, 0){
		if(z > 0 && a[i] >= 0){
			a[i] -= sen;
			z--;
		}
	}
	
	bool ans = true;
	zep(i, 0, n){
		if(a[i] >= 0){
			ans = false;
		}
	}
	print((ans)? "Yes" : "No")
	return 0;
}
            
            
            
        
            
divinediscon10t