結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 22:28:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,118 bytes |
| コンパイル時間 | 1,710 ms |
| コンパイル使用メモリ | 174,316 KB |
| 実行使用メモリ | 11,368 KB |
| 最終ジャッジ日時 | 2024-07-03 04:28:55 |
| 合計ジャッジ時間 | 5,871 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 2 TLE * 1 -- * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
signed main(){
int n, x, y, z;
cin >> n >> x >> y >> z;
priority_queue<int> que;
for(int i = 0;i < n;i++){
int a;
cin >> a;
a++;
if(a % 1000 != 0) a += 1000;
a /= 1000;
que.push(a);
}
while(!que.empty()){
if(z == 0) break;
int a = que.top();
que.pop();
if(a < 10){
z--;
}else{
if(a / 10 <= z){
z -= a / 10;
if(a % 10 != 0) que.push(a%10);
}else{
a -= z * 10;
z = 0;
que.push(a);
}
}
}
while(!que.empty()){
if(y == 0) break;
int a = que.top();
que.pop();
if(y < 5){
y--;
}else{
if(a / 5 <= y){
y -= a / 5;
if(a % 5 != 0) que.push(a%5);
}else{
a -= y * 5;
y = 0;
que.push(a);
}
}
}
while(!que.empty()){
int a = que.top();
que.pop();
if(a > x){
cout << "No" << endl;
return 0;
}else{
x -= a;
}
}
cout << "Yes" << endl;
return 0;
}