結果

問題 No.1015 おつりは要らないです
ユーザー zssazssa
提出日時 2020-04-03 21:35:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,238 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 166,212 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 00:28:26
合計ジャッジ時間 29,617 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
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 16 ms
4,376 KB
testcase_32 AC 16 ms
4,376 KB
testcase_33 TLE -
testcase_34 AC 1 ms
4,376 KB
testcase_35 WA -
testcase_36 AC 1 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];
    }
    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