結果
問題 | No.1015 おつりは要らないです |
ユーザー |
![]() |
提出日時 | 2020-04-03 21:38:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,522 bytes |
コンパイル時間 | 2,345 ms |
コンパイル使用メモリ | 198,388 KB |
最終ジャッジ日時 | 2025-01-09 12:44:42 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 RE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template<typename T> void chmin(T &a, const T &b) { a = min(a, b); } template<typename T> void chmax(T &a, const T &b) { a = max(a, b); } struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio; #ifdef DEBUG_ #include "../program_contest_library/memo/dump.hpp" #else #define dump(...) #endif const ll INF = 1LL<<60; int main(void) { ll n, x, y, z; cin >> n >> x >> y >> z; vector<ll> a(n); REP(i, n) { cin >> a[i]; a[i] = (a[i]+1000)/1000*1000; } { REP(i, n) { ll num = min(a[i] / 10000, z); a[i] -= num * 10000; z -= num; } sort(ALL(a), greater<>()); REP(i, z) a[i] = 0; z = 0; } { REP(i, n) { ll num = min(a[i] / 5000, y); a[i] -= num * 5000; y -= num; } sort(ALL(a), greater<>()); REP(i, y) a[i] = 0; y = 0; } { REP(i, n) { ll num = min(a[i] / 1000, x); a[i] -= num * 1000; x -= num; } sort(ALL(a), greater<>()); REP(i, x) a[i] = 0; x = 0; } bool flag = true; REP(i, n) if(a[i] > 0) flag = false; if(flag) cout << "Yes" << endl; else cout << "No" << endl; return 0; }