結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー rlangevinrlangevin
提出日時 2023-05-11 08:58:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,442 ms / 3,000 ms
コード長 665 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 122,464 KB
最終ジャッジ日時 2024-11-27 09:21:51
合計ジャッジ時間 18,330 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,360 KB
testcase_01 AC 39 ms
52,884 KB
testcase_02 AC 36 ms
53,548 KB
testcase_03 AC 36 ms
52,780 KB
testcase_04 AC 1,276 ms
103,128 KB
testcase_05 AC 678 ms
108,776 KB
testcase_06 AC 100 ms
97,424 KB
testcase_07 AC 36 ms
52,400 KB
testcase_08 AC 244 ms
93,628 KB
testcase_09 AC 282 ms
95,600 KB
testcase_10 AC 563 ms
85,648 KB
testcase_11 AC 108 ms
80,120 KB
testcase_12 AC 82 ms
76,112 KB
testcase_13 AC 133 ms
87,284 KB
testcase_14 AC 491 ms
98,112 KB
testcase_15 AC 877 ms
104,016 KB
testcase_16 AC 500 ms
84,388 KB
testcase_17 AC 557 ms
92,460 KB
testcase_18 AC 302 ms
87,228 KB
testcase_19 AC 224 ms
84,000 KB
testcase_20 AC 86 ms
78,172 KB
testcase_21 AC 468 ms
93,700 KB
testcase_22 AC 867 ms
101,416 KB
testcase_23 AC 1,442 ms
122,464 KB
testcase_24 AC 1,069 ms
108,108 KB
testcase_25 AC 419 ms
101,656 KB
testcase_26 AC 159 ms
97,224 KB
testcase_27 AC 486 ms
105,196 KB
testcase_28 AC 157 ms
96,628 KB
testcase_29 AC 586 ms
105,292 KB
testcase_30 AC 1,364 ms
119,004 KB
testcase_31 AC 163 ms
97,140 KB
testcase_32 AC 121 ms
96,632 KB
testcase_33 AC 56 ms
67,004 KB
testcase_34 AC 38 ms
52,212 KB
testcase_35 AC 37 ms
53,948 KB
testcase_36 AC 36 ms
52,744 KB
testcase_37 AC 36 ms
53,480 KB
testcase_38 AC 72 ms
76,128 KB
testcase_39 AC 66 ms
75,700 KB
testcase_40 AC 61 ms
69,368 KB
testcase_41 AC 74 ms
76,244 KB
testcase_42 AC 60 ms
70,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

def check(m):
    L = []
    for h in H:
        if h - m > 0:
            L.append(-h + m)
    heapify(L)
    AA = A
    while AA and L:
        v = -heappop(L)
        if v >= X:
            n = min(AA, v//X)
            v -= X * n
            AA -= n
            if v:
                heappush(L, -v)
        else:
            AA -= 1
    L.append(0)
    return -sum(L) <= B * Y


N, A, B, X, Y = map(int, input().split())
H = list(map(int, input().split()))

if check(0):
    print(0)
    exit()
no = 0
yes = 10 ** 9 + 5
while yes - no != 1:
    mid = (yes + no)//2
    if check(mid):
        yes = mid
    else:
        no = mid
print(yes)
0