結果

問題 No.1015 おつりは要らないです
ユーザー IKyoproIKyopro
提出日時 2020-04-03 23:09:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 878 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 201,008 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 04:23:42
合計ジャッジ時間 4,038 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 13 ms
4,384 KB
testcase_12 AC 12 ms
4,376 KB
testcase_13 AC 13 ms
4,376 KB
testcase_14 AC 12 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 12 ms
4,376 KB
testcase_21 AC 11 ms
4,380 KB
testcase_22 AC 12 ms
4,380 KB
testcase_23 AC 12 ms
4,380 KB
testcase_24 AC 12 ms
4,380 KB
testcase_25 AC 12 ms
4,380 KB
testcase_26 AC 12 ms
4,380 KB
testcase_27 AC 12 ms
4,380 KB
testcase_28 AC 12 ms
4,376 KB
testcase_29 AC 12 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 10 ms
4,380 KB
testcase_32 AC 10 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    vec<int> X(3);
    cin >> N >> X[0] >> X[1] >> X[2];
    vec<int> B = {1000,5000,10000};
    vec<int> A(N);
    bool ok = true;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        for(int j=2;j>=0;j--){
            if(B[j]>=a){
                int n  = min(a/B[j],X[j]);
                a -= n*B[j];
                X[j] -= n;
            }
        }
        for(int j=0;j<3;j++) if(X[j]){
            X[j]--;
            a = -1;
            break;
        }
        ok &= a==-1;
    }
    cerr << B[0] << " " << B[1] << " " << B[2] << "\n";
    cout << (ok? "Yes\n":"No\n");
}
0