結果

問題 No.1015 おつりは要らないです
ユーザー coco18000coco18000
提出日時 2020-04-03 21:39:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,210 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 167,656 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-16 00:40:35
合計ジャッジ時間 4,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 20 ms
4,376 KB
testcase_11 AC 21 ms
4,380 KB
testcase_12 AC 20 ms
4,380 KB
testcase_13 AC 21 ms
4,380 KB
testcase_14 AC 22 ms
4,380 KB
testcase_15 AC 21 ms
4,376 KB
testcase_16 AC 20 ms
4,376 KB
testcase_17 AC 21 ms
4,380 KB
testcase_18 AC 21 ms
4,376 KB
testcase_19 AC 21 ms
4,376 KB
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 9 ms
4,376 KB
testcase_32 AC 10 ms
4,376 KB
testcase_33 AC 15 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 WA -
testcase_36 AC 1 ms
4,376 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);
    REP(i, N) {
        ll m = (A[i] + 999) / 1000;
        ll z = std::min(m / 10, Z);
        Z -= z;
        m -= z * 10;
        ll y = std::min(m / 5, Y);
        Y -= y;
        m -= y * 5;
        if (m > X) {
            if (m >= 5)
                return false;
            if (Y > 0) {
                Y--;
                m = 0;
            }
            else if (Z > 0) {
                Z--;
                m = 0;
            }
        }
        else {
            X -= m;
            m = 0;
        }
        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