結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー kaeru82433413kaeru82433413
提出日時 2021-11-12 21:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,687 ms / 3,000 ms
コード長 512 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 107,828 KB
最終ジャッジ日時 2024-05-04 08:12:41
合計ジャッジ時間 31,876 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,224 KB
testcase_01 AC 41 ms
52,096 KB
testcase_02 AC 37 ms
52,992 KB
testcase_03 AC 48 ms
61,824 KB
testcase_04 AC 1,339 ms
107,584 KB
testcase_05 AC 1,646 ms
107,752 KB
testcase_06 AC 966 ms
107,128 KB
testcase_07 AC 51 ms
62,464 KB
testcase_08 AC 253 ms
93,452 KB
testcase_09 AC 353 ms
102,588 KB
testcase_10 AC 954 ms
88,320 KB
testcase_11 AC 733 ms
85,376 KB
testcase_12 AC 100 ms
76,680 KB
testcase_13 AC 926 ms
96,544 KB
testcase_14 AC 1,124 ms
99,928 KB
testcase_15 AC 912 ms
106,844 KB
testcase_16 AC 1,039 ms
84,644 KB
testcase_17 AC 521 ms
91,376 KB
testcase_18 AC 1,118 ms
92,024 KB
testcase_19 AC 320 ms
91,976 KB
testcase_20 AC 201 ms
83,000 KB
testcase_21 AC 563 ms
102,920 KB
testcase_22 AC 885 ms
103,208 KB
testcase_23 AC 1,574 ms
106,236 KB
testcase_24 AC 1,526 ms
107,424 KB
testcase_25 AC 1,671 ms
107,828 KB
testcase_26 AC 1,432 ms
106,512 KB
testcase_27 AC 1,687 ms
107,372 KB
testcase_28 AC 1,448 ms
106,276 KB
testcase_29 AC 1,637 ms
107,032 KB
testcase_30 AC 1,512 ms
106,472 KB
testcase_31 AC 1,445 ms
105,648 KB
testcase_32 AC 1,589 ms
107,040 KB
testcase_33 AC 66 ms
71,552 KB
testcase_34 AC 56 ms
75,392 KB
testcase_35 AC 73 ms
76,416 KB
testcase_36 AC 68 ms
75,776 KB
testcase_37 AC 76 ms
75,520 KB
testcase_38 AC 79 ms
76,288 KB
testcase_39 AC 69 ms
75,648 KB
testcase_40 AC 61 ms
74,240 KB
testcase_41 AC 78 ms
76,416 KB
testcase_42 AC 70 ms
76,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop as pop, heappush as push, heapify

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

def solve(k):
    hh = list(map(lambda x: -(x-k), H))
    heapify(hh)
    for _ in range(A):
        h = -pop(hh)
        h -= X
        push(hh, -h)
    remain = 0
    for h in hh:
        remain += max(0, -h)
    return remain <= Y*B

ok, ng = max(H), -1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if solve(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0