結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
konaaiocxvmq982
|
| 提出日時 | 2020-04-03 22:29:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 3,320 bytes |
| コンパイル時間 | 1,844 ms |
| コンパイル使用メモリ | 174,816 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 23:12:01 |
| 合計ジャッジ時間 | 4,582 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;
static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
namespace Kunitaka{
template<
typename TYPE,
std::size_t SIZE
>
std::size_t array_length(const TYPE (&array)[SIZE])
{
return SIZE;
}
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; }
}
using namespace Kunitaka;
namespace Printer{
void br(){
cout << endl;
}
void loop_cnt(int i){
cout << "i = " << i << endl;
}
void loop_cnt(int i, int j){
cout << "i = " << i << ", " << "j = " << j << endl;
}
template<class T>
void print(T x){
cout << x << endl;
}
template<class T, class S>
void print(T x, S y){
cout << x << "," << y << endl;
}
template<class T, class S, class U>
void print(T x, S y, U z){
cout << x << "," << y << "," << z << endl;
}
template<class T, class S>
void print(pair<T, S> p){
cout << p.first << ", " << p.second << endl;
}
template<
typename TYPE,
std::size_t SIZE
>
void print(const TYPE (&array)[SIZE]){
int lim = array_length(array);
for(int i=0; i<lim; i++){
if(i) cout << " ";
cout << array[i];
}
cout << endl;
}
template<class S>
void print(vector<S> v){
for(int i=0; i<v.size(); i++){
if(i) cout << " ";
cout<< v[i];
}
cout << endl;
}
template<class S>
void print(vector<vector<S> > vv){
for(int i=0; i<vv.size(); i++){
for(int j=0; j<vv[i].size(); j++){
if(j) cout << " ";
cout << vv[i][j];
}
cout << endl;
}
}
void yesno(bool x){
if(x) cout << "Yes" << endl;
else cout << "No" << endl;
}
};
using namespace Printer;
ll gausu(ll val, ll x){
if(val == 0) return 1;
ll res = val / x;
res++;
return res;
}
int main(int argc, const char * argv[]) {
//提出時、消す----//
//--------------//
// input
cout << fixed << setprecision(10);
ll N, X, Y, Z; cin >> N >> X >> Y >> Z;
ll vals[3] = {Z, Y, X};
ll en[3] = {10000, 5000, 1000};
vector<ll> A(N);
rep(i, N) cin >> A[i];
rep(j, 3){
sort(ALL(A), greater<int>());
rep(i, N){
if(A[i] < 0) continue;
ll tmp = A[i] / en[j];
tmp = min(tmp, vals[j]);
A[i] -= tmp * en[j];
vals[j]-= tmp;
}
sort(ALL(A), greater<int>());
rep(i, min(N, vals[j])){
A[i] -= en[j];
}
}
bool ok = true;
rep(i, N){
// print(A[i]);
if(A[i] >= 0) ok = false;
}
yesno(ok);
return 0;
}
konaaiocxvmq982