結果
問題 | No.1015 おつりは要らないです |
ユーザー |
![]() |
提出日時 | 2020-04-03 21:45:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 805 bytes |
コンパイル時間 | 720 ms |
コンパイル使用メモリ | 75,008 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 01:54:39 |
合計ジャッジ時間 | 2,971 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 WA * 17 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, X, Y, Z; cin >> n >> X >> Y >> Z; vector<int> la(n); for (int i = 0; i < n; ++i) { cin >> la[i]; } sort(la.begin(), la.end(), greater<int>()); for (int a: la) { int q = a%10000; if (q < 1000 && X > 0) { --X; a -= 1000; } else if (q < 5000 && Y > 0) { --Y; a -= 5000; } int z = min(a/10000+1, Z); a -= z*10000; Z -= z; // cerr << a << " " << z << " " << Z << endl; if (a < 0) continue; int y = min(a/5000+1,Y); a -= y*5000; Y -= y; if (a < 0) continue; int x = min(a/1000+1,X); a -= x*1000; X -= x; if (a < 0) continue; cout << "No" << endl; return 0; } cout << "Yes" << endl; }