結果
| 問題 | No.1015 おつりは要らないです |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-06 16:33:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 1,447 bytes |
| コンパイル時間 | 2,202 ms |
| コンパイル使用メモリ | 197,824 KB |
| 最終ジャッジ日時 | 2025-01-09 14:32:07 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h> // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif // clang-format on
/**
* author: knshnb
* created: Mon Apr 6 16:02:49 JST 2020
**/
signed main() {
Int n, x, y, z;
std::cin >> n >> x >> y >> z;
std::priority_queue<Int> pq;
REP(i, n) {
Int a;
std::cin >> a;
pq.push(a + 1);
}
while (pq.size()) {
Int a = pq.top();
pq.pop();
if (z > 0) {
if (a < 10000) {
z--;
} else {
Int use = std::min(z, a / 10000);
z -= use, a -= use * 10000;
pq.push(a);
}
} else if (y > 0) {
if (a < 5000) {
y--;
} else {
Int use = std::min(y, a / 5000);
y -= use, a -= use * 5000;
pq.push(a);
}
} else {
pq.push(a);
break;
}
}
while (pq.size()) {
x -= (pq.top() + 999) / 1000;
pq.pop();
}
std::cout << (x >= 0 ? "Yes" : "No") << std::endl;
}