結果
| 問題 |
No.1736 Princess vs. Dragoness
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 22:35:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,058 bytes |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 82,200 KB |
| 実行使用メモリ | 77,952 KB |
| 最終ジャッジ日時 | 2024-11-25 20:01:02 |
| 合計ジャッジ時間 | 4,092 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 33 |
ソースコード
# import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
import math
import bisect
import heapq
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e20)
mod = int(1e9+7)
import time
import copy
n,a,b,x,y = mp()
h = lmp()
hq = [(-h[i],i) for i in range(n)]
heapq.heapify(hq)
while a != 0:
here,num = heapq.heappop(hq)
#print(here,num)
heapq.heappush(hq, (here+x, num))
a -= 1
hq.sort(key=lambda x:x[1])
hq = deque(hq)
while b != 0:
now = y
while now != 0 and hq:
u = hq.popleft()
if u[0] >= 0:continue
if -now <= u[0]:
now += u[0]
else:
hq.appendleft((u[0]+now,u[1]))
now = 0
b -= 1
if b == 0 or not hq:
break
#print(hq)
if not hq:print("Yes")
else:print("No")