結果

問題 No.1015 おつりは要らないです
ユーザー zssazssa
提出日時 2020-04-03 22:33:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,866 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 170,344 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 03:22:37
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll N,M;
    //string S;
    cin >> N;
    vector<ll> A(N);
    ll X,Y,Z;
    cin >> X>>Y>>Z;
    rep(i,N){
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<ll>());
    rep(i,N){
        ll rz = A[i] / 10000;
        ll tmp = A[i] % 10000;
        ll ry = tmp / 5000;
        tmp %= 5000;
        ll rx = tmp / 1000;
        tmp %= 1000;
        X -= rx;
        Y -= ry;
        Z -= rz;
        //cout << X <<" "<<Y<<" "<< Z<<endl;
        if(tmp >= 0){
            if(X > 0){
                X--;
            }else if(Y > 0){
                Y--;
            }else if(Z > 0){
                Z--;
            }else{
                cout << "No" <<endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    /*
    rep(i,N){
        if(A[i] < 1000 && X>0){
            X--;
            continue;
        }else if(A[i] < 5000 && Y > 0){
            Y--;
            continue;
        }else if(A[i] < 10000 && Z > 0){
            Z--;
            continue;
        }
        while(A[i] >= 10000 && Z>0){
            A[i] -= 10000;
            Z--;
        }
        while(A[i] >= 5000 && Y>0){
            A[i] -= 5000;
            Y--;
        }
        while(A[i] >= 1000 && X>0){
            A[i] -= 1000;
            X--;
        }
        if(A[i] >= 1000){
            cout << "No" <<endl;
            return 0;
        }
        if(A[i] >= 0){
            if(X > 0){
                X--;
            }else if(Y > 0){
                Y--;
            }else if(Z > 0){
                Z--;
            }else{
                cout << "No" <<endl;
                return 0;
            }
        }

    }
    cout << "Yes" << endl;
    */
}
0