結果

問題 No.1015 おつりは要らないです
ユーザー tempura_pp
提出日時 2020-04-03 21:24:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,144 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 114,384 KB
最終ジャッジ日時 2025-01-09 12:42:14
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 17 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll x,y,z;
    cin>>x>>y>>z;
    rep(i,n){
        ll a;
        cin>>a;
        int t = max(a/10000,z);
        a -= t*10000;
        z -= t;
        t = max(a/5000,y);
        a -= t*5000;
        y -= t;
        t = max(a/1000,x);
        a -= t*1000;
        x -= t;
        if(a<1000 && x){
            x--;
        }
        else if(a<5000 && y){
            y--;
        }
        else if(a<10000 && z){
            z--;
        }
        else {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
0