結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
![]() |
提出日時 | 2021-12-29 12:12:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 952 bytes |
コンパイル時間 | 1,912 ms |
コンパイル使用メモリ | 199,448 KB |
最終ジャッジ日時 | 2025-01-27 07:28:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) typedef long long ll; #define int long long static const int mod=998244353; signed main(){ int n,a,b,x,y; cin>>n>>a>>b>>x>>y; priority_queue<int>pq; rep(i,n){ int temp; cin>>temp; pq.push(temp); } rep(i,a){ int temp=pq.top(); pq.pop(); temp-=x; pq.push(temp); } //cout<<pq.top()<<endl; rep(i,b){ int res=y; while(res>0){ //cout<<res<<endl; if(pq.top()<=0){ cout<<"Yes"<<endl; return 0; } if(pq.top()<=res){ res-=pq.top(); pq.pop(); pq.push(0); } else{ int temp=pq.top()-res; pq.pop(); pq.push(temp); res=0; } } } while(!pq.empty()){ //cout<<pq.top()<<endl; if(pq.top()>0){ cout<<"No"<<endl; return 0; } pq.pop(); } cout<<"Yes"<<endl; return 0; }