結果

問題 No.1736 Princess vs. Dragoness
ユーザー incuiio
提出日時 2023-05-10 16:51:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 1,098 ms
コンパイル使用メモリ 129,904 KB
最終ジャッジ日時 2025-02-12 21:11:43
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>
#include <cassert>
#include <regex>
using std::cout;
using std::cin;
using std::string;
using std::vector;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    long long x, y;
    cin >> x >> y;
    std::priority_queue<long long> arr;
    long long total_health = 0;
    for (int i = 0; i < n; i++)
    {
        long long health;
        cin >> health;
        arr.push(health);
        total_health += health;
    }
    long long a_damage = 0;
    while (a > 0)
    {
        a_damage += std::min(arr.top(), x);
        long long new_health = arr.top() - std::min(arr.top(), x);
        arr.pop();
        arr.push(new_health);
        a--;
    }
    if (a_damage >= total_health - b * y)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}
0