結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
![]() |
提出日時 | 2020-04-03 22:40:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,539 bytes |
コンパイル時間 | 1,788 ms |
コンパイル使用メモリ | 166,488 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 05:01:12 |
合計ジャッジ時間 | 3,390 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 WA * 2 |
ソースコード
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; const ll inf=1e9+7; const ll mod=1e9+7; int main(){ ll n,x,y,z; cin>>n>>x>>y>>z; bool f=1; rep(i,n){ ll a;cin>>a; a-=a%1000LL; a+=1000LL; if(a%5000LL){ if(a%5000LL<=x*1000LL){ x-=(a%5000LL)/1000LL; a-=a%5000LL; }else{ a-=a%5000LL; a+=5000LL; } } if(a%10000LL){ if(a%10000LL<=y*5000LL){ y-=(a%10000LL)/5000LL; a-=a%10000LL; }else if(a%10000LL<=x*1000LL){ x-=(a%10000LL)/1000LL; a-=a%10000LL; }else{ a-=a%10000LL; a+=10000LL; } } if(a/10000LL<=z){ z-=a/10000LL; a=0; }else{ a-=z*10000LL; z=0; } if(a/5000LL<=y){ y-=a/5000LL; a=0; }else{ a-=y*5000LL; y=0; } if(a/1000LL<=x){ x-=a/1000LL; a=0; }else{ a-=x*1000LL; x=0; } if(a)f=0; } if(f)cout<<"Yes"<<endl; else cout<<"No"<<endl; }