結果

問題 No.1015 おつりは要らないです
ユーザー pionepione
提出日時 2020-04-03 23:23:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,035 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 172,024 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-16 04:54:25
合計ジャッジ時間 3,846 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,x,y,z; cin>>n>>x>>y>>z;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  sort(a.rbegin(),a.rend());
  ll rem=0;
  rep(i,n){
    if(a[i]>10000 && z>0){
      ll cnt=min((a[i]+10000-1)/10000, z);
      a[i]-=10000*cnt;
      z-=cnt;
    }
    if(a[i]>5000 && y>0){
      ll cnt=min((a[i]+5000-1)/5000, y);
      a[i]-=5000*cnt;
      y-=cnt;
    }
    if(a[i]>0 && z>0){
      ll cnt=min((a[i]+1000-1)/1000, x);
      a[i]-=1000*cnt;
      x-=cnt;
    }
    if(a[i]>0){
      rem++;
    }
  }
  if(rem>0 && rem>(x+y+z)){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  
}
0