結果

問題 No.1015 おつりは要らないです
ユーザー むかでむかで
提出日時 2020-04-03 21:48:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,854 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 174,556 KB
実行使用メモリ 4,768 KB
最終ジャッジ日時 2023-08-11 08:39:49
合計ジャッジ時間 4,333 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 4 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 29 ms
4,612 KB
testcase_11 AC 26 ms
4,556 KB
testcase_12 AC 25 ms
4,380 KB
testcase_13 AC 26 ms
4,568 KB
testcase_14 AC 25 ms
4,768 KB
testcase_15 AC 27 ms
4,608 KB
testcase_16 AC 25 ms
4,612 KB
testcase_17 AC 29 ms
4,608 KB
testcase_18 AC 27 ms
4,688 KB
testcase_19 AC 25 ms
4,560 KB
testcase_20 AC 23 ms
4,560 KB
testcase_21 AC 23 ms
4,564 KB
testcase_22 AC 23 ms
4,552 KB
testcase_23 AC 22 ms
4,384 KB
testcase_24 AC 24 ms
4,680 KB
testcase_25 AC 23 ms
4,656 KB
testcase_26 AC 23 ms
4,568 KB
testcase_27 AC 23 ms
4,556 KB
testcase_28 AC 23 ms
4,560 KB
testcase_29 AC 23 ms
4,676 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 12 ms
4,668 KB
testcase_32 AC 12 ms
4,564 KB
testcase_33 AC 18 ms
4,736 KB
testcase_34 AC 2 ms
4,384 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; ll x,y,z; cin>>n>>x>>y>>z;
    vll a(n);
    rep(i,n) cin>>a[i];
    vll b(n);
    rep(i,n) b[i]=(a[i]+1000)/1000;
    // 10
    sort(rall(b));
    rep(i,n){
        ll c = b[i]/10;
        if (z<=c){
            b[i]-=z*10;
            z=0;
            break;
        }else{
            b[i]-=c*10;
            z-=c;
        }
    }
    sort(all(b));
    rep(i,z) b.pop_back();
    reverse(all(b));
    n = b.size();
    // 5
    rep(i,n){
        ll c = b[i]/5;
        if (y<=c){
            b[i]-=y*5;
            y=0;
            break;
        }else{
            b[i]-=c*5;
            y-=c;
        }
    }
    sort(all(b));
    rep(i,y) b.pop_back();
    reverse(all(b));
    n = b.size();
    // 1
    ll sum=0;
    rep(i,n) sum+=b[i];
    if (sum<=x){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}
0