結果

問題 No.1015 おつりは要らないです
ユーザー ferinferin
提出日時 2020-04-03 21:38:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,522 bytes
コンパイル時間 2,198 ms
コンパイル使用メモリ 204,380 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 08:38:34
合計ジャッジ時間 4,683 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, x, y, z;
    cin >> n >> x >> y >> z;
    vector<ll> a(n);
    REP(i, n) {
        cin >> a[i];
        a[i] = (a[i]+1000)/1000*1000;
    }

    {
        REP(i, n) {
            ll num = min(a[i] / 10000, z);
            a[i] -= num * 10000;
            z -= num;
        }
        sort(ALL(a), greater<>());
        REP(i, z) a[i] = 0;
        z = 0;
    }

    {
        REP(i, n) {
            ll num = min(a[i] / 5000, y);
            a[i] -= num * 5000;
            y -= num;
        }
        sort(ALL(a), greater<>());
        REP(i, y) a[i] = 0;
        y = 0;
    }

    {
        REP(i, n) {
            ll num = min(a[i] / 1000, x);
            a[i] -= num * 1000;
            x -= num;
        }
        sort(ALL(a), greater<>());
        REP(i, x) a[i] = 0;
        x = 0;
    }

    bool flag = true;
    REP(i, n) if(a[i] > 0) flag = false;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}
0