結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2020-04-03 22:36:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 1,226 bytes |
コンパイル時間 | 1,581 ms |
コンパイル使用メモリ | 173,836 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 23:12:51 |
合計ジャッジ時間 | 3,847 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second const int mx=8010; const ll mod=1e9+7; int main(){ int n; ll x,y,z; cin >> n >> x >> y >> z; vector<ll> a(n); rep(i,n){ cin>>a[i]; a[i]++; } rep(i,n){ ll k = a[i]/10000; a[i] %= 10000; if(z>=k){ z -= k; } else { k -= z; z=0; a[i] += 10000*k; } } sort(a.rbegin(),a.rend()); if(z>0){ rep(i,n){ if(z>0){ a[i]=0; z--; } } } sort(a.rbegin(),a.rend()); rep(i,n)if(a[i]!=0){ ll k = a[i]/5000; a[i] %= 5000; if(y>=k){ y -= k; } else { k -= y; y=0; a[i] += 5000*k; } } sort(a.rbegin(),a.rend()); if(y>0){ rep(i,n){ if(y>0){ a[i]=0; y--; } } } sort(a.rbegin(),a.rend()); rep(i,n)if(a[i]!=0){ ll k = (a[i]+999)/1000; if(x>=k){ x -= k; } else { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }