結果
| 問題 | No.1015 おつりは要らないです |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-04 02:16:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 3,092 bytes |
| コンパイル時間 | 1,158 ms |
| コンパイル使用メモリ | 114,472 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 23:20:18 |
| 合計ジャッジ時間 | 3,020 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;
typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932; // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, x, y, z;
cin >> n >> x >> y >> z;
vector<int> a(n);
for(int i = 0; i < n; ++i) cin >> a[i], ++a[i];
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = a[i] / 10000;
if(need <= z){
a[i] -= need * 10000;
z -= need;
}
else{
a[i] -= z * 10000;
z = 0;
break;
}
}
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = ceil((double)a[i] / 10000);
if(need <= z){
a[i] = 0;
z -= need;
}
else{
a[i] -= z * 10000;
z = 0;
break;
}
}
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = a[i] / 5000;
if(need <= y){
a[i] -= need * 5000;
y -= need;
}
else{
a[i] -= y * 5000;
y = 0;
break;
}
}
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = ceil((double)a[i] / 5000);
if(need <= y){
a[i] = 0;
y -= need;
}
else{
a[i] -= y * 5000;
y = 0;
break;
}
}
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = a[i] / 1000;
if(need <= x){
a[i] -= need * 1000;
x -= need;
}
else{
a[i] -= x * 1000;
x = 0;
break;
}
}
sort(a.begin(), a.end(), greater<int>());
for(int i = 0; i < n; ++i){
int need = ceil((double)a[i] / 1000);
if(need <= x){
a[i] = 0;
x -= need;
}
else{
a[i] -= x * 1000;
x = 0;
break;
}
}
for(int i = 0; i < n; ++i){
if(a[i] > 0){
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
}