結果
| 問題 | 
                            No.1015 おつりは要らないです
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sash2104
                         | 
                    
| 提出日時 | 2020-04-03 21:40:06 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 603 bytes | 
| コンパイル時間 | 718 ms | 
| コンパイル使用メモリ | 75,264 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-03 01:49:23 | 
| 合計ジャッジ時間 | 2,722 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 15 WA * 18 | 
ソースコード
#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 z = min(a/10000+1, Z);
    a -= z*10000;
    Z -= z;
    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;
}
            
            
            
        
            
sash2104