結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 47 ms
4,380 KB
testcase_16 AC 48 ms
4,380 KB
testcase_17 AC 49 ms
4,376 KB
testcase_18 AC 47 ms
4,376 KB
testcase_19 AC 47 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 2 ms
4,376 KB
testcase_31 AC 24 ms
4,376 KB
testcase_32 AC 24 ms
4,380 KB
testcase_33 AC 52 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 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;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    a++;
    v.push_back((a+999)/1000);
  }

  sort(ALLOF(v),[](const ll& x, const ll& y){
    return x%10 > y%10;
  });

  if(Z > 0){
    rep(i,N){
      ll x = (v[i]+9)/10;
      ll y = min(x, Z);
      Z -= y;
      v[i] -= 10 * y;
      v[i] = max(0LL, v[i]);
    }
  }

  sort(ALLOF(v),[](const ll& x, const ll& y){
    return x%5 > y%5;
  });

  if(Y > 0){
    rep(i,N){
      ll x = (v[i]+4)/5;
      ll y = min(x, Y);
      Y -= y;
      v[i] -= 5 * y;
      v[i] = max(0LL, v[i]);
    }
  }
  
  ll sum = 0;
  rep(i,N){
    sum += v[i];
  }

  if(sum <= X) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}
0