結果

問題 No.1015 おつりは要らないです
ユーザー tempura_pptempura_pp
提出日時 2020-04-03 21:32:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,562 bytes
コンパイル時間 1,201 ms
コンパイル使用メモリ 123,776 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 00:24:21
合計ジャッジ時間 3,416 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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;
    vector<ll> b(n);
    rep(i,n)cin>>b[i];
    sort(b.begin(),b.end());
    rep(i,n){
        ll a=b[i];
        int s = min(a/10000,z);
        a -= s*10000;
        z -= s;
        int t = min(a/5000,y);
        a -= t*5000;
        y -= t;
        int u = min(a/1000,x);
        a -= u*1000;
        x -= u;
        if(a<1000 && x){
            x--;
        }
        else if(a<5000 && y){
            while(a<5000 && u>0){
                --u;
                ++x;
                a+=1000;
            }
            y--;
        }
        else if(a<10000 && z){
            while(a<10000 && u>0){
                --u;
                ++x;
                a+=1000;
            }
            while(a<10000 && t>0){
                --t;
                ++y;
                a+=5000;
            }

            z--;
        }
        else {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
0