結果

問題 No.1015 おつりは要らないです
ユーザー kappybarkappybar
提出日時 2020-04-03 21:57:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,310 bytes
コンパイル時間 1,526 ms
コンパイル使用メモリ 171,860 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 01:19:59
合計ジャッジ時間 4,075 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 73 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 52 ms
4,380 KB
testcase_18 AC 50 ms
4,376 KB
testcase_19 AC 50 ms
4,380 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
4,376 KB
testcase_31 AC 18 ms
4,380 KB
testcase_32 AC 19 ms
4,376 KB
testcase_33 AC 41 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll INF = 1e18;
const int MOD = 1000000007;

int main(){
        int n,x,y,z;
        cin >> n >> x >> y >> z;
        priority_queue<int> pq;
        bool ok = true;
        rep(i,n){
                int a;
                cin >> a;
                pq.push(a);
        }

        while(x > 0 && !pq.empty()){
                int p = pq.top();
                pq.pop();
                if(p < 100000){
                        x--;
                }else{
                        if(x >= p/10000){
                                x -= p/10000;
                                p %= 10000;
                                if(p!=0) pq.push(p);
                        }else{
                                x = 0;
                                p -= x*10000;
                                if(p!=0) pq.push(p);
                        }
                }
        }

        while(y > 0 && !pq.empty()){
                int p = pq.top();
                pq.pop();
                if(p < 5000){
                        y--;
                }else{
                        if(y >= p/5000){
                                y -= p/5000;
                                p %= 5000;
                                if(p!=0) pq.push(p);
                        }else{
                                y = 0;
                                p -= y*5000;
                                if(p!=0) pq.push(p);
                        }
                }
        }

        while(z > 0 && !pq.empty()){
                int p = pq.top();
                pq.pop();
                if(p < 1000){
                        z--;
                }else{
                        if(z >= p/1000){
                                z -= p/1000;
                                p %= 1000;
                                if(p!=0)pq.push(p);
                        }else{
                                z = 0;
                                p -= z*1000;
                                if(p!=0)pq.push(p);
                        }
                }
        }

        while(pq.top() == 0) pq.pop();

        if(pq.empty()) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
}




0