結果

問題 No.1015 おつりは要らないです
ユーザー kyort0nkyort0n
提出日時 2020-04-03 21:31:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 1,587 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 175,412 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-29 01:09:54
合計ジャッジ時間 3,324 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, X, Y, Z;
    cin >> N >> X >> Y >> Z;
    vector<ll> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        A[i]++;
        ll num = min(Z, A[i] / 10000);
        Z -= num;
        A[i] -= 10000 * num;
    }
    sort(A.begin(), A.end(), greater<ll>());
    for(int i = 0; i < A.size(); i++) {
        if(Z > 0) {
            A[i] -= 10000;
            Z--;
        }
        //cerr << A[i] << endl;
    }
    vector<ll> B;
    for(int i = 0; i < A.size(); i++) {
        if(A[i] <= 0) continue;
        ll num = min(Y, A[i] / 5000);
        B.push_back(A[i] - 5000 * num);
        Y -= num;
    }
    sort(B.begin(), B.end(), greater<ll>());
    N = B.size();
    for(int i = 0; i < B.size(); i++) {
        if(Y > 0) {
            B[i] -= 5000;
            Y--;
        }
        if(B[i] <= 0) continue;
        X -= (B[i] + 999) / 1000;
        //cerr << B[i] << " " << X << endl;
    }
    if(X >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
0