結果

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

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, x, y, z; cin >> n >> x >> y >> z;
    ll a[n]; zep(i, 0, n){cin >> a[i];}
    
    ll man = 10000;
    ll go = 5000;
    ll sen = 1000;
    zep(i, 0, n){
        a[i] -= min(x, a[i]/man)*man;
        x -= min(x, a[i]/man);
        a[i] -= min(y, a[i]/go)*go;
        y -= min(y, a[i]/go);
        a[i] -= min(z, a[i]/sen)*sen;
        z -= min(z, a[i]/sen);
    }
    sort(a, a+n);

    zep(i, 0, n){
        if(a[i] >= 0 && z > 0){
            a[i] -= sen;
            z--;
        }
        if(a[i] >= 0 && y > 0){
            a[i] -= go;
            y--;
        }
        if(a[i] >= 0 && x > 0){
            a[i] -= sen;
            x--;
        }
        if(a[i] >= 0){
            print("No")
            return 0;
        }
    }
    print("Yes")
    return 0;
}
0