結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
uw_yu1rabbit
|
| 提出日時 | 2020-08-17 13:20:30 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 776 bytes |
| コンパイル時間 | 12,510 ms |
| コンパイル使用メモリ | 284,004 KB |
| 最終ジャッジ日時 | 2025-01-13 02:29:25 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,x,y,z;
cin >> n >> x >> y >> z;
vector<int> a(n);
rep(i,n) cin >> a[i];
rep(i,n) a[i] = (a[i] / 1000 + 1) * 1000;
vector<int> c{10000,5000,1000};
vector<int> v{z,y,x};
rep(t,3){
int C = c[t],V = v[t];
rep(i,n){
int k = min(a[i] / C,V);
a[i] -= C * k;
V -= k;
}
sort(a.rbegin(),a.rend());
rep(i,min(n,V))a[i] = 0;
}
bool f = true;
rep(i,n)if(a[i] != 0)f = false;
if(f)cout << "Yes";
else cout << "No";
cout << endl;
}
uw_yu1rabbit