結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
![]() |
提出日時 | 2021-12-29 12:12:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 952 bytes |
コンパイル時間 | 2,002 ms |
コンパイル使用メモリ | 200,924 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-07-04 14:06:29 |
合計ジャッジ時間 | 2,769 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#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; }