結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー rlangevinrlangevin
提出日時 2023-05-11 08:58:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,816 ms / 3,000 ms
コード長 665 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 123,780 KB
最終ジャッジ日時 2023-08-18 06:03:28
合計ジャッジ時間 23,147 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,008 KB
testcase_01 AC 84 ms
71,368 KB
testcase_02 AC 89 ms
71,224 KB
testcase_03 AC 81 ms
71,284 KB
testcase_04 AC 1,591 ms
105,640 KB
testcase_05 AC 883 ms
110,016 KB
testcase_06 AC 145 ms
97,788 KB
testcase_07 AC 85 ms
71,296 KB
testcase_08 AC 348 ms
94,876 KB
testcase_09 AC 407 ms
98,528 KB
testcase_10 AC 742 ms
87,288 KB
testcase_11 AC 149 ms
81,480 KB
testcase_12 AC 118 ms
77,568 KB
testcase_13 AC 198 ms
88,492 KB
testcase_14 AC 653 ms
100,636 KB
testcase_15 AC 1,129 ms
107,156 KB
testcase_16 AC 620 ms
86,568 KB
testcase_17 AC 712 ms
93,976 KB
testcase_18 AC 386 ms
88,888 KB
testcase_19 AC 311 ms
85,652 KB
testcase_20 AC 124 ms
79,772 KB
testcase_21 AC 595 ms
94,744 KB
testcase_22 AC 1,132 ms
103,316 KB
testcase_23 AC 1,816 ms
123,780 KB
testcase_24 AC 1,385 ms
109,856 KB
testcase_25 AC 533 ms
104,400 KB
testcase_26 AC 222 ms
97,432 KB
testcase_27 AC 638 ms
107,940 KB
testcase_28 AC 227 ms
97,560 KB
testcase_29 AC 780 ms
107,436 KB
testcase_30 AC 1,814 ms
121,772 KB
testcase_31 AC 222 ms
97,544 KB
testcase_32 AC 175 ms
97,608 KB
testcase_33 AC 110 ms
76,396 KB
testcase_34 AC 80 ms
71,292 KB
testcase_35 AC 83 ms
71,328 KB
testcase_36 AC 79 ms
71,376 KB
testcase_37 AC 78 ms
71,068 KB
testcase_38 AC 117 ms
77,436 KB
testcase_39 AC 123 ms
76,972 KB
testcase_40 AC 115 ms
77,220 KB
testcase_41 AC 119 ms
77,184 KB
testcase_42 AC 117 ms
77,240 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