結果

問題 No.1015 おつりは要らないです
ユーザー sugarrrsugarrr
提出日時 2020-04-03 21:55:29
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,297 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 164,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 21:01:19
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,248 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 21 ms
5,376 KB
testcase_11 AC 21 ms
5,376 KB
testcase_12 AC 20 ms
5,376 KB
testcase_13 AC 21 ms
5,376 KB
testcase_14 AC 22 ms
5,376 KB
testcase_15 AC 21 ms
5,376 KB
testcase_16 AC 22 ms
5,376 KB
testcase_17 AC 22 ms
5,376 KB
testcase_18 AC 21 ms
5,376 KB
testcase_19 AC 22 ms
5,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
5,376 KB
testcase_31 AC 19 ms
5,376 KB
testcase_32 AC 18 ms
5,376 KB
testcase_33 AC 21 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 WA -
testcase_36 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

bool comp(ll i,ll j){
    return i%5<j%5;
}
bool comp1(ll i,ll j){
    return i%10<j%!0;
}

int main(){fastio
    ll n,x,y,z;cin>>n>>x>>y>>z;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll c[n];
    rep(i,0,n-1){
        c[i]=(a[i])/1000+1;
    }
    sort(c,c+n,comp);
    for(ll i=0;i<n && x>0;i++){
        if(c[i]%5==0)continue;
        if(c[i]%5<=x){
            x-=c[i]%5;
            c[i]-=c[i]%5;
        }else{
            break;
        }
    }
    if(x>0){
        y+=x/5;
        for(ll i=0;i<n && y>0;i++){
            if(c[i]%10==5){
                y-=1;
                c[i]-=5;
            }
        }
        z+=y/2;
        ll sum=0;
        rep(i,0,n-1){
            sum+=(c[i]+9)/10;
        }
        if(sum>z){
            cout<<"No"<<endl;
            return 0;
        }else{
            cout<<"Yes"<<endl;
        }
    }else{
        sort(c,c+n,comp1);
        for(ll i=0;i<n && y>0;i++){
            if(c[i]%10==0)continue;
            if(c[i]%10<=y*5){
                if(c[i]%10<=5){
                    y-=1;
                    c[i]-=5;
                }else{
                    y-=2;
                    c[i]-=10;
                }
            }else{
                break;
            }
        }
        z+=y/2;
        ll sum=0;
        rep(i,0,n-1){
            sum+=(c[i]+9)/10;
        }
        if(sum>z){
            cout<<"No"<<endl;
            return 0;
        }else{
            cout<<"Yes"<<endl;
        }
    }
    
    
    return 0;
}
0