結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2020-04-03 21:32:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,562 bytes |
| コンパイル時間 | 1,661 ms |
| コンパイル使用メモリ | 120,064 KB |
| 最終ジャッジ日時 | 2025-01-09 12:43:23 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 11 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin>>n;
ll x,y,z;
cin>>x>>y>>z;
vector<ll> b(n);
rep(i,n)cin>>b[i];
sort(b.begin(),b.end());
rep(i,n){
ll a=b[i];
int s = min(a/10000,z);
a -= s*10000;
z -= s;
int t = min(a/5000,y);
a -= t*5000;
y -= t;
int u = min(a/1000,x);
a -= u*1000;
x -= u;
if(a<1000 && x){
x--;
}
else if(a<5000 && y){
while(a<5000 && u>0){
--u;
++x;
a+=1000;
}
y--;
}
else if(a<10000 && z){
while(a<10000 && u>0){
--u;
++x;
a+=1000;
}
while(a<10000 && t>0){
--t;
++y;
a+=5000;
}
z--;
}
else {
cout<<"No"<<endl;
return 0;
}
}
cout<<"Yes"<<endl;
return 0;
}
tempura_pp