結果
問題 | No.1736 Princess vs. Dragoness |
ユーザー | bayashi-cl |
提出日時 | 2021-11-12 22:09:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-11-25 18:56:44 |
合計ジャッジ時間 | 2,291 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
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()