結果

問題 No.1015 おつりは要らないです
ユーザー auauaauaua
提出日時 2020-04-03 22:01:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,583 bytes
コンパイル時間 1,380 ms
コンパイル使用メモリ 164,920 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 01:34:31
合計ジャッジ時間 3,643 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n,x,y,z;cin>>n>>x>>y>>z;
    bool f=1;
    rep(i,n){
        ll a;cin>>a;
        a=(a/1000+1)*1000;
        if(a%5000){
        if(a%5000<=x*1000){
            x-=(a%5000)/1000;
            a-=a%5000;
        }else{
            if(a%5000)a=((a-1)/5000+1)*5000;
        }
        }
        if(a==0)continue;
        if(a%10000){
        if(a%10000<=y*5000){
            y-=(a%10000)/5000;
            a-=a%10000;
        }else if(a%10000<=x*1000){
            x-=(a%10000)/1000;
            a-=a%10000;
        }else{
            a=((a-1)/10000+1)*10000;
        }
        }
        if(a==0)continue;
        if(a/10000<=z){
            z-=a/10000;
            a=0;
        }else{
            a-=z*10000;
            z=0;
        }
        if(a==0)continue;
        if(a/5000<=y){
            y-=a/5000;
            a=0;
        }else{
            a-=y*5000;
            y=0;
        }
        if(a==0)continue;
        if(a/1000<=x){
            x-=a/1000;
            a=0;
        }else{
            a-=x*1000;
            x=0;
        }
        if(a==0)continue;
        if(a)f=0;
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0