結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2020-04-03 22:03:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,648 bytes |
コンパイル時間 | 1,586 ms |
コンパイル使用メモリ | 169,268 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 02:51:28 |
合計ジャッジ時間 | 3,818 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 WA * 3 |
ソースコード
#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]; rep(i,n){ ll k = a[i]/10000; a[i] %= 10000; if(a[i]==0) a[i]++; if(z>=k){ z -= k; } else { k -= z; z=0; a[i] += 10000*k; } } // sort(a.rbegin(),a.rend()); rep(i,n){ ll k = a[i]/10000; a[i] %= 10000; if(a[i]==0) a[i]++; if(z>=k){ z -= k; } else { k -= z; z=0; a[i] += 10000*k; } k = a[i]/5000; a[i] %= 5000; if(a[i]==0) a[i]++; if(y>=k){ y -= k; } else { k -= y; y=0; a[i] += 5000*k; } k = (a[i]+999)/1000; if(x>=k){ x -= k; } else { // k -= x; // a[i] -= 1000*x; // x=0; if(a[i]%10000<=5000 && y>0){ y--; a[i] -= 5000; if(a[i]<=0) continue; } k = (a[i]+9999)/10000; if(z>=k){ z -= k; } else { a[i] -= 10000*z; z=0; k = (a[i]+4999)/5000; if(y>=k){ y -= k; } else { a[i] -= 5000*y; y=0; k = (a[i]+999)/1000; if(x>=k){ x -= k; } else { cout << "No" << endl; return 0; } } } } } cout << "Yes" << endl; return 0; }