結果

問題 No.1015 おつりは要らないです
ユーザー furafura
提出日時 2020-06-02 19:06:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 205,692 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 09:05:36
合計ジャッジ時間 4,959 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,248 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 28 ms
5,376 KB
testcase_16 AC 28 ms
5,376 KB
testcase_17 AC 29 ms
5,376 KB
testcase_18 AC 27 ms
5,376 KB
testcase_19 AC 28 ms
5,376 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 2 ms
5,376 KB
testcase_31 AC 13 ms
5,376 KB
testcase_32 AC 13 ms
5,376 KB
testcase_33 AC 17 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>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,x,y,z; scanf("%d%d%d%d",&n,&x,&y,&z);

	priority_queue<int> Q;
	rep(i,n){
		int a; scanf("%d",&a);
		Q.emplace(a+1);
	}

	while(z>0 && !Q.empty()){
		int a=Q.top(); Q.pop();
		int k=min((a+9999)/10000,z);
		a-=10000*k;
		if(a>0) Q.emplace(a);
		z-=k;
	}
	while(y>0 && !Q.empty()){
		int a=Q.top(); Q.pop();
		int k=min((a+4999)/5000,y);
		a-=5000*k;
		if(a>0) Q.emplace(a);
		y-=k;
	}
	while(x>0 && !Q.empty()){
		int a=Q.top(); Q.pop();
		int k=min((a+999)/1000,x);
		a-=1000*k;
		if(a>0) Q.emplace(a);
		x-=k;
	}

	puts(Q.empty()?"Yes":"No");

	return 0;
}
0