結果

問題 No.1736 Princess vs. Dragoness
ユーザー U S
提出日時 2021-11-12 22:24:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 77,744 KB
最終ジャッジ日時 2024-11-25 19:30:15
合計ジャッジ時間 3,706 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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)]
while a != 0:
    here,num = heapq.heappop(hq)
    heapq.heappush(hq, (here+x, num))
    a -= 1
hq.sort(key=lambda x:x[1])
hq = deque(hq)
while True:
    now = y
    while now != 0 and hq:
        u = hq.popleft()
        if u[0] >= 0:continue
        if -now <= u[0]:
            now += u[0]
        else:
            hq.append((u[0]+now,u[1]))
            now = 0
    b -= 1
    if b == 0 or not hq:
        break
if not hq:print("Yes")
else:print("No")
0