結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
|
提出日時 | 2021-11-12 22:09:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2025-07-04 14:04:22 |
合計ジャッジ時間 | 2,672 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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()