結果

問題 No.1015 おつりは要らないです
ユーザー coco18000coco18000
提出日時 2020-04-03 21:55:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,207 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 171,684 KB
実行使用メモリ 5,140 KB
最終ジャッジ日時 2023-09-16 01:17:03
合計ジャッジ時間 3,831 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 25 ms
4,772 KB
testcase_16 AC 25 ms
4,972 KB
testcase_17 AC 26 ms
4,940 KB
testcase_18 AC 25 ms
4,904 KB
testcase_19 AC 25 ms
4,968 KB
testcase_20 AC 25 ms
4,800 KB
testcase_21 AC 24 ms
4,788 KB
testcase_22 AC 24 ms
4,840 KB
testcase_23 AC 23 ms
5,040 KB
testcase_24 AC 24 ms
4,944 KB
testcase_25 AC 24 ms
4,920 KB
testcase_26 AC 24 ms
4,956 KB
testcase_27 AC 24 ms
4,772 KB
testcase_28 AC 23 ms
4,776 KB
testcase_29 AC 24 ms
4,780 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 12 ms
4,936 KB
testcase_32 AC 13 ms
4,936 KB
testcase_33 AC 19 ms
4,992 KB
testcase_34 AC 2 ms
4,380 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;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll N, X, Y, Z;
ll A[100005];

bool check() {
    sort(A, A + N);
    vector<ll> v;
    REP(i, N) {
        ll m = (A[i] + 999) / 1000;
        ll z = std::min(m / 10, Z);
        Z -= z;
        m -= z * 10LL;
        v.push_back(m);
    }
    sort(v.begin(), v.end(), greater<ll>());
    REP(i, N) {
        ll m = v[i];
        ll z = std::min((m + 9) / 10, Z);
        Z -= z;
        m = std::max(0LL, m - z * 10);
        ll y = std::min((m + 4) / 5, Y);
        Y -= y;
        m = std::max(0LL, m - y * 5);
        ll x = std::min(X, m);
        X -= x;
        m -= x;

        if (m > 0)
            return false;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> X >> Y >> Z;
    REP(i, N) {
        cin >> A[i];
        if (A[i] % 1000 == 0)
            A[i]++;
    }
    if (check())
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
0