結果

問題 No.1015 おつりは要らないです
ユーザー erbowlerbowl
提出日時 2020-04-03 21:40:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,524 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 173,668 KB
実行使用メモリ 5,092 KB
最終ジャッジ日時 2023-09-16 00:42:39
合計ジャッジ時間 3,866 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 33 ms
4,820 KB
testcase_16 AC 33 ms
4,832 KB
testcase_17 AC 34 ms
4,960 KB
testcase_18 AC 33 ms
4,876 KB
testcase_19 AC 32 ms
4,912 KB
testcase_20 AC 34 ms
4,776 KB
testcase_21 AC 34 ms
4,808 KB
testcase_22 AC 34 ms
4,764 KB
testcase_23 AC 33 ms
4,856 KB
testcase_24 AC 35 ms
4,788 KB
testcase_25 AC 34 ms
4,760 KB
testcase_26 AC 33 ms
4,768 KB
testcase_27 AC 34 ms
4,776 KB
testcase_28 AC 33 ms
4,768 KB
testcase_29 AC 35 ms
4,888 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 13 ms
4,900 KB
testcase_32 AC 12 ms
4,952 KB
testcase_33 AC 17 ms
5,092 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,x,y,z;
    std::cin >> n>>x>>y>>z;
    
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    priority_queue<ll> pq;
    for (int i = 0; i < n; i++) {
        pq.push((a[i]+999)/1000);
    }
    
    while(pq.size()&&z>0){
        auto now = pq.top();pq.pop();
        if(now<=10){
            z--;
            continue;
        }
        if(now/10 <= z ){
            z -= now/10;
            now %= 10;
        }else{
            now -= z*10;
            z = 0;
        }
        pq.push(now);
    }
    if(pq.size()==0){
        std::cout << "Yes" << std::endl;
        return 0;
    }
    while(pq.size()&&y>0){
        auto now = pq.top();pq.pop();
        if(now<=5){
            y--;
            continue;
        }
        if(now/5 <= y ){
            y -= now/5;
            now %= 5;
        }else{
            now -= y*5;
            y = 0;
        }
        pq.push(now);
    }
    
    if(pq.size()==0){
        std::cout << "Yes" << std::endl;
        return 0;
    }
    
    while(pq.size()&&x>0){
        auto now = pq.top();pq.pop();
        if(x>=now){
            x -= now;
            continue;
        }else{
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    if(pq.size()==0){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

}

0