結果
| 問題 |
No.1736 Princess vs. Dragoness
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-29 11:10:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 108 ms / 2,000 ms |
| コード長 | 555 bytes |
| コンパイル時間 | 613 ms |
| コンパイル使用メモリ | 82,596 KB |
| 実行使用メモリ | 77,296 KB |
| 最終ジャッジ日時 | 2025-07-04 14:07:35 |
| 合計ジャッジ時間 | 3,965 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
import heapq
N,A,B,X,Y = map(int,input().split())
H = list(map(int,input().split()))
heap = []
for i in range(N):
heapq.heappush(heap,-H[i])
cnt = 0
while heap and cnt<A:
h = -heapq.heappop(heap)
h -= X
cnt += 1
if h>0:
heapq.heappush(heap,-h)
for _ in range(B):
p = Y
A = []
while p>0 and heap:
h = -heapq.heappop(heap)
d = min(h,p)
h -= d
p -= d
if h>0:
A.append(h)
for a in A:
heapq.heappush(heap,-a)
if heap:
print("No")
else:
print("Yes")