結果

問題 No.1015 おつりは要らないです
ユーザー hirokazu1020
提出日時 2020-04-03 21:37:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,118 bytes
コンパイル時間 2,926 ms
コンパイル使用メモリ 98,060 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 01:40:16
合計ジャッジ時間 3,445 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()


long long n, x, y, z;
long long a[100000];


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> x >> y >> z;
	rep(i, n)cin >> a[i];
	rep(i, n)a[i]++;

	rep(i, n) {
		int t = min(a[i] / 10000, z);
		a[i] -= t * 10000;
		z -= t;
	}
	rep(i, n) {
		int t = min(a[i] / 5000, y);
		a[i] -= t * 5000;
		y -= t;
	}
	int w = y + z;
	sort(a, a + n);
	bool ok = true;
	
	rep(i, n) {
		if (a[i] <= x * 1000) {
			x -= (a[i] + 999) / 1000;
		}
		else if (w) {
			w--;
		}
		else {
			ok = false;
			break; 
		}
	}cout << (ok ? "Yes" : "No") << endl;



	return 0;
}
0