結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
![]() |
提出日時 | 2021-11-13 18:50:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 584 ms |
コンパイル使用メモリ | 57,048 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 18:06:30 |
合計ジャッジ時間 | 1,638 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
/* -*- coding: utf-8 -*- * * 1736.cc: No.1736 Princess vs. Dragoness - yukicoder */ #include<cstdio> #include<queue> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 3000; /* typedef */ typedef long long ll; typedef vector<int> vi; typedef queue<int> qi; typedef pair<int,int> pii; /* global variables */ int hs[MAX_N]; /* subroutines */ /* main */ int main() { int n, a, b, x, y; scanf("%d%d%d%d%d", &n, &a, &b, &x, &y); for (int i = 0; i < n; i++) scanf("%d", hs + i); priority_queue<int> q(hs, hs + n); while (a > 0 && ! q.empty()) { int h = q.top(); q.pop(); if (h >= x) { int d = min(a, h / x); h -= d * x, a -= d; } else h -= x, a--; if (h > 0) q.push(h); } ll sum = 0; while (! q.empty()) sum += q.top(), q.pop(); if (sum <= (ll)y * b) puts("Yes"); else puts("No"); return 0; }