結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2020-04-03 21:40:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,524 bytes |
コンパイル時間 | 1,763 ms |
コンパイル使用メモリ | 174,436 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 01:49:46 |
合計ジャッジ時間 | 3,637 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 26 WA * 7 |
ソースコード
typedef long long ll; #include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n,x,y,z; std::cin >> n>>x>>y>>z; vector<ll> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } priority_queue<ll> pq; for (int i = 0; i < n; i++) { pq.push((a[i]+999)/1000); } while(pq.size()&&z>0){ auto now = pq.top();pq.pop(); if(now<=10){ z--; continue; } if(now/10 <= z ){ z -= now/10; now %= 10; }else{ now -= z*10; z = 0; } pq.push(now); } if(pq.size()==0){ std::cout << "Yes" << std::endl; return 0; } while(pq.size()&&y>0){ auto now = pq.top();pq.pop(); if(now<=5){ y--; continue; } if(now/5 <= y ){ y -= now/5; now %= 5; }else{ now -= y*5; y = 0; } pq.push(now); } if(pq.size()==0){ std::cout << "Yes" << std::endl; return 0; } while(pq.size()&&x>0){ auto now = pq.top();pq.pop(); if(x>=now){ x -= now; continue; }else{ std::cout << "No" << std::endl; return 0; } } if(pq.size()==0){ std::cout << "Yes" << std::endl; }else{ std::cout << "No" << std::endl; } }