結果

問題 No.1015 おつりは要らないです
ユーザー どららどらら
提出日時 2020-04-03 21:43:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,235 bytes
コンパイル時間 1,525 ms
コンパイル使用メモリ 174,176 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 00:44:15
合計ジャッジ時間 4,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll N, X, Y, Z;
  cin >> N >> X >> Y >> Z;
  priority_queue<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push(a+1);
  }

  while(Z>0){
    if(v.empty()) break;
    ll a = v.top();

    if(a > 10000){
      v.pop();
      ll y = min(a/10000, Z);
      a -= y * 10000;
      Z -= y;
      v.push(a);
    }else break;
  }
  while(Z>0){
    if(v.empty()) break;
    ll a = v.top(); v.pop();
    Z--;
  }
  while(Y>0){
    if(v.empty()) break;
    ll a = v.top();

    if(a > 5000){
      v.pop();
      ll y = min(a/5000, Y);
      a -= y * 5000;
      Y -= y;
      v.push(a);
    }else break;
  }
  while(Y>0){
    if(v.empty()) break;
    ll a = v.top(); v.pop();
    Y--;
  }
  while(X>0){
    if(v.empty()) break;
    ll a = v.top(); v.pop();
    ll y = min((a+999)/1000, X);
    X -= y;
    if(a - y * 1000 > 0) v.push(a);
  }

  if(v.empty()) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

0