結果

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

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

int main() {
    cin>>N;
    vec num(3);
    rep(i,3) cin>>num[i];
    vec a(N);
    vec value = {1, 5, 10};
    rep(i,N){
        cin>>a[i];
        a[i] = a[i] / 1000 + 1;
        ll minus = min(num[2], a[i] / value[2]);
        num[2] -= minus;
        a[i] -= value[2] * minus;
    }
    sort(ALL(a));
    reverse(ALL(a));
    rep(i,N){
        if(num[2] == 0) {
            break;
        }
        else {
            a[i] = 0;
            num[2]--;
        }
    }
    rep(i,N){
        ll minus = min(num[1], a[i] / value[1]);
        num[1] -= minus;
        a[i] -= value[1] * minus;
    }
    sort(ALL(a));
    reverse(ALL(a));
    rep(i,N){
        if(num[1] == 0) {
            break;
        }else{
            a[i] = 0;
            --num[1];
        }
    }
    ll sum = 0;
    rep(i,N) sum += a[i];
    cout<<(sum <= num[0] ? "Yes" : "No")<<endl;
}
0