結果

問題 No.1015 おつりは要らないです
ユーザー carrot46carrot46
提出日時 2020-04-03 21:52:39
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 1,363 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 171,044 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 08:40:32
合計ジャッジ時間 4,483 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 44 ms
4,380 KB
testcase_11 AC 45 ms
4,380 KB
testcase_12 AC 43 ms
4,380 KB
testcase_13 AC 45 ms
4,376 KB
testcase_14 AC 48 ms
4,380 KB
testcase_15 AC 44 ms
4,380 KB
testcase_16 AC 44 ms
4,380 KB
testcase_17 AC 46 ms
4,376 KB
testcase_18 AC 45 ms
4,376 KB
testcase_19 AC 45 ms
4,376 KB
testcase_20 AC 41 ms
4,380 KB
testcase_21 AC 40 ms
4,380 KB
testcase_22 AC 40 ms
4,380 KB
testcase_23 AC 39 ms
4,380 KB
testcase_24 AC 41 ms
4,380 KB
testcase_25 AC 41 ms
4,376 KB
testcase_26 AC 40 ms
4,376 KB
testcase_27 AC 40 ms
4,380 KB
testcase_28 AC 40 ms
4,376 KB
testcase_29 AC 40 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 20 ms
4,376 KB
testcase_32 AC 19 ms
4,376 KB
testcase_33 AC 45 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,380 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