結果

問題 No.1015 おつりは要らないです
ユーザー leaf_1415leaf_1415
提出日時 2020-04-03 21:43:09
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,563 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 6,120 KB
最終ジャッジ日時 2023-09-16 00:44:24
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 32 ms
5,828 KB
testcase_11 AC 33 ms
5,832 KB
testcase_12 AC 31 ms
5,908 KB
testcase_13 AC 32 ms
5,936 KB
testcase_14 AC 34 ms
5,852 KB
testcase_15 AC 31 ms
5,936 KB
testcase_16 AC 33 ms
5,932 KB
testcase_17 AC 33 ms
5,912 KB
testcase_18 AC 32 ms
5,960 KB
testcase_19 AC 32 ms
5,960 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,376 KB
testcase_31 AC 17 ms
5,968 KB
testcase_32 AC 18 ms
6,052 KB
testcase_33 AC 25 ms
5,920 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 WA -
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n, x, y, z;
llint a[100005];
vector<P> vec;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> x >> y >> z;
	for(int i = 1; i <= n; i++) cin >> a[i], a[i] = (a[i]+1000) / 1000;
	
	
	for(int i = 1; i <= n; i++) vec.push_back(P(a[i]%5, i));
	sort(vec.begin(), vec.end());
	
	for(int i = 0; i < vec.size(); i++){
		llint id = vec[i].second;
		if(vec[i].first > x) a[id] = (a[id]+4)/5*5;
		else x -= vec[i].first, a[id] -= vec[i].first;
	}
	
	
	y += x / 5;
	for(int i = 1; i <= n; i++) a[i] /= 5;
	
	vec.clear();
	for(int i = 1; i <= n; i++) vec.push_back(P(a[i]%2, i));
	sort(vec.begin(), vec.end());
	
	for(int i = 0; i < vec.size(); i++){
		llint id = vec[i].second;
		if(vec[i].first > y) a[id] = (a[id]+1)/2*2;
		else y -= vec[i].first, a[id] -= vec[i].first;
	}
	
	
	z += y / 2;
	for(int i = 1; i <= n; i++) a[i] /= 2;
	
	for(int i = 1; i <= n; i++) z -= a[i];
	if(z >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}
0