結果

問題 No.1736 Princess vs. Dragoness
コンテスト
ユーザー Kou0406
提出日時 2025-01-15 11:02:07
言語 C++14
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 866 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 745 ms
コンパイル使用メモリ 94,964 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-14 15:18:25
合計ジャッジ時間 2,514 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef pair<int,int> P;

int n,a,b;
ll x,y;

int main(){
    int i,j,cnt;
    ll p,d;
    P now;
    scanf("%d%d%d%lld%lld",&n,&a,&b,&x,&y);
    vector<int> h(n);
    cnt=n;
    priority_queue<P> PQ;
    rep(i,n){
        scanf("%d",&h[i]);
        PQ.push(P(h[i],i));
    }
    while(a>0){
        now=PQ.top();PQ.pop();
        h[now.second]-=x;
        now.first=h[now.second];
        if(h[now.second]<=0)cnt--;
        else PQ.push(now);
        a--;
    }
    p=y*b;
    rep(i,n){
        if(h[i]>0){
            d=min((ll)h[i],p);
            h[i]-=d;
            p-=d;
            if(h[i]<=0)cnt--;
        }
    }
    printf("%s\n",cnt==0?"Yes":"No");
    return 0;
}
0