結果
| 問題 | No.1736 Princess vs. Dragoness |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 22:09:42 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| + 862µs | |
| コード長 | 625 bytes |
| 記録 | |
| コンパイル時間 | 756 ms |
| コンパイル使用メモリ | 21,280 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-07-13 00:49:24 |
| 合計ジャッジ時間 | 5,866 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
import heapq
from operator import itemgetter
def main() -> None:
n, a, b, x, y = map(int, input().split())
rem_b = y * b
h = list(map(int, input().split()))
que = [(-h[i], i) for i in range(n)]
heapq.heapify(que)
for _ in range(a):
top, i = heapq.heappop(que)
top += x
heapq.heappush(que, (top, i))
que.sort(key=itemgetter(1))
for hi, _ in que:
hi *= -1
if hi >= 0:
if hi > rem_b:
print("No")
return
else:
rem_b -= hi
print("Yes")
if __name__ == "__main__":
main()