結果

問題 No.1015 おつりは要らないです
ユーザー RhoRho
提出日時 2020-04-03 21:44:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,014 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 167,036 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-16 00:46:56
合計ジャッジ時間 3,997 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 46 ms
4,376 KB
testcase_11 AC 47 ms
4,376 KB
testcase_12 AC 44 ms
4,380 KB
testcase_13 AC 46 ms
4,380 KB
testcase_14 AC 47 ms
4,380 KB
testcase_15 AC 45 ms
4,376 KB
testcase_16 AC 46 ms
4,376 KB
testcase_17 AC 47 ms
4,380 KB
testcase_18 AC 47 ms
4,376 KB
testcase_19 AC 45 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 24 ms
4,380 KB
testcase_32 AC 24 ms
4,376 KB
testcase_33 AC 51 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int a[100006];
signed main() {
	int n, x, y, z; cin >> n >> x >> y >> z;
	rep(i, n) {
		cin >> a[i];
		a[i] = a[i] / 1000 + 1;
	}

	rep(i, n) {
		int t = a[i] / 10;
		if (z >= t) {
			z -= t;
			a[i] %= 10;
		}
		else {
			a[i] -= z * 10;
			z = 0;
		}
	}
	rep(i, n) {
		int t = a[i] / 5;
		if (y >= t) {
			y -= t;
			a[i] %= 5;
		}
		else {
			a[i] -= 5 * y;
			y = 0;
		}
	}

	sort(a, a + n);
	reverse(a, a + n);
	rep(i, n) {
		int t = (a[i]+9) / 10;
		if (z >= t) {
			z -= t;
			a[i] = 0;
		}
		else {
			a[i] -= z * 10;
			z = 0;
		}
	}
	sort(a, a + n);
	reverse(a, a + n);
	rep(i, n) {
		int t = (a[i]+4) / 5;
		if (y >= t) {
			y -= t;
			a[i] = 0;
		}
		else {
			a[i] -= 5 * y;
			y = 0;
		}
	}
	sort(a, a + n);
	reverse(a, a + n);
	rep(i, n) {
		if (x >= a[i]) {
			x -= a[i];
			a[i] = 0;
		}
		else {
			a[i] -= x;
			x = 0;
		}
	}
	sort(a, a + n);
	if (a[n - 1])puts("No");
	else puts("Yes");
}
0