結果

問題 No.1015 おつりは要らないです
ユーザー divinediscon10tdivinediscon10t
提出日時 2020-04-05 02:50:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 971 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 169,364 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 05:06:52
合計ジャッジ時間 3,586 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 29 ms
5,376 KB
testcase_11 AC 30 ms
5,376 KB
testcase_12 AC 28 ms
5,376 KB
testcase_13 AC 29 ms
5,376 KB
testcase_14 AC 31 ms
5,376 KB
testcase_15 AC 28 ms
5,376 KB
testcase_16 AC 29 ms
5,376 KB
testcase_17 AC 30 ms
5,376 KB
testcase_18 AC 28 ms
5,376 KB
testcase_19 AC 29 ms
5,376 KB
testcase_20 AC 25 ms
5,376 KB
testcase_21 AC 24 ms
5,376 KB
testcase_22 AC 24 ms
5,376 KB
testcase_23 AC 23 ms
5,376 KB
testcase_24 AC 24 ms
5,376 KB
testcase_25 AC 23 ms
5,376 KB
testcase_26 AC 24 ms
5,376 KB
testcase_27 AC 23 ms
5,376 KB
testcase_28 AC 23 ms
5,376 KB
testcase_29 AC 24 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 14 ms
5,376 KB
testcase_32 AC 14 ms
5,376 KB
testcase_33 AC 21 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

ll n, x, y, z, a[100008]; 

void f(ll &k, ll gaku){
	zep(i, 0, n){
		if(a[i] > 0){
			ll buf = min(k, a[i]/gaku);
			a[i] -= buf*gaku;
			k -= buf;
		}
	}
	sort(a, a+n);
	rrep(i, n-1, 0){
		if(k > 0 && a[i] >= 0){
			a[i] -= gaku;
			k--;
		}
	}
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> x >> y >> z;
	zep(i, 0, n){cin >> a[i];}
	
	ll man = 10000;
	ll go = 5000;
	ll sen = 1000;

	f(z, man);
	f(y, go);
	f(x, sen);
	
	bool ans = true;
	zep(i, 0, n){
		if(a[i] >= 0){
			ans = false;
		}
	}
	print((ans)? "Yes" : "No")
	return 0;
}
0