結果
問題 | No.1736 Princess vs. Dragoness |
ユーザー |
|
提出日時 | 2021-11-12 22:40:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 1,099 bytes |
コンパイル時間 | 320 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 77,980 KB |
最終ジャッジ日時 | 2024-11-25 20:14:43 |
合計ジャッジ時間 | 3,836 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
# import sys# input = sys.stdin.readlinedef 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 mathimport bisectimport heapqfrom copy import deepcopy as dcfrom itertools import accumulatefrom collections import Counter, defaultdict, dequedef ceil(U,V):return (U+V-1)//Vdef modf1(N,MOD):return (N-1)%MOD+1inf = int(1e20)mod = int(1e9+7)import timeimport copyn,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 -= 1hq.sort(key=lambda x:x[1])hq = deque(hq)while b != 0:now = ywhile now != 0 and hq:u = hq.popleft()if u[0] >= 0:continueif -now <= u[0]:now += u[0]else:hq.appendleft((u[0]+now,u[1]))now = 0b -= 1if b == 0 or not hq:break#print(hq)f = Truefor i,j in hq:if i < 0:f = Falseif f:print("Yes")else:print("No")