結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 38 ms
4,380 KB
testcase_11 AC 39 ms
4,376 KB
testcase_12 AC 37 ms
4,376 KB
testcase_13 AC 38 ms
4,376 KB
testcase_14 AC 40 ms
4,504 KB
testcase_15 AC 38 ms
4,376 KB
testcase_16 AC 38 ms
4,380 KB
testcase_17 AC 40 ms
4,380 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 38 ms
4,380 KB
testcase_20 AC 36 ms
4,380 KB
testcase_21 AC 36 ms
4,380 KB
testcase_22 AC 36 ms
4,380 KB
testcase_23 AC 34 ms
4,376 KB
testcase_24 AC 35 ms
4,380 KB
testcase_25 AC 36 ms
4,376 KB
testcase_26 AC 35 ms
4,376 KB
testcase_27 AC 35 ms
4,380 KB
testcase_28 AC 35 ms
4,376 KB
testcase_29 AC 36 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 16 ms
4,380 KB
testcase_32 AC 17 ms
4,376 KB
testcase_33 AC 43 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,384 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%1000LL;
        a+=1000LL;
        if(a%5000LL){
        if(a%5000LL<=x*1000LL){
            x-=(a%5000LL)/1000LL;
            a-=a%5000LL;
        }else{
            a-=a%5000LL;
            a+=5000LL;
        }
        }
        if(a%10000LL){
        if(a%10000LL<=y*5000LL){
            y-=(a%10000LL)/5000LL;
            a-=a%10000LL;
        }else if(a%10000LL<=x*1000LL){
            x-=(a%10000LL)/1000LL;
            a-=a%10000LL;
        }else{
            a-=a%10000LL;
            a+=10000LL;
        }
        }
        if(a/10000LL<=z){
            z-=a/10000LL;
            a=0;
        }else{
            a-=z*10000LL;
            z=0;
        }
        if(a/5000LL<=y){
            y-=a/5000LL;
            a=0;
        }else{
            a-=y*5000LL;
            y=0;
        }
        if(a/1000LL<=x){
            x-=a/1000LL;
            a=0;
        }else{
            a-=x*1000LL;
            x=0;
        }
        if(a)f=0;
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0