結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
|
提出日時 | 2021-11-12 22:40:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 111 ms / 2,000 ms |
コード長 | 1,099 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 82,832 KB |
実行使用メモリ | 78,968 KB |
最終ジャッジ日時 | 2025-07-04 14:04:52 |
合計ジャッジ時間 | 3,957 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
# 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) f = True for i,j in hq: if i < 0:f = False if f:print("Yes") else:print("No")