結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 👑 rin204rin204
提出日時 2022-01-23 07:36:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 729 ms / 3,000 ms
コード長 535 bytes
コンパイル時間 769 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 205,836 KB
最終ジャッジ日時 2023-08-19 10:36:28
合計ジャッジ時間 19,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,200 KB
testcase_01 AC 73 ms
71,340 KB
testcase_02 AC 74 ms
71,256 KB
testcase_03 AC 74 ms
71,156 KB
testcase_04 AC 599 ms
105,552 KB
testcase_05 AC 729 ms
189,860 KB
testcase_06 AC 288 ms
205,836 KB
testcase_07 AC 73 ms
71,356 KB
testcase_08 AC 435 ms
128,740 KB
testcase_09 AC 487 ms
115,012 KB
testcase_10 AC 230 ms
84,836 KB
testcase_11 AC 252 ms
85,680 KB
testcase_12 AC 90 ms
76,304 KB
testcase_13 AC 489 ms
134,756 KB
testcase_14 AC 543 ms
147,644 KB
testcase_15 AC 647 ms
144,292 KB
testcase_16 AC 241 ms
94,420 KB
testcase_17 AC 366 ms
119,972 KB
testcase_18 AC 297 ms
91,108 KB
testcase_19 AC 163 ms
83,236 KB
testcase_20 AC 214 ms
85,104 KB
testcase_21 AC 378 ms
97,148 KB
testcase_22 AC 565 ms
134,828 KB
testcase_23 AC 650 ms
144,728 KB
testcase_24 AC 726 ms
181,496 KB
testcase_25 AC 602 ms
129,536 KB
testcase_26 AC 704 ms
188,800 KB
testcase_27 AC 657 ms
114,352 KB
testcase_28 AC 707 ms
186,360 KB
testcase_29 AC 660 ms
113,752 KB
testcase_30 AC 612 ms
139,616 KB
testcase_31 AC 706 ms
187,184 KB
testcase_32 AC 714 ms
190,812 KB
testcase_33 AC 82 ms
75,872 KB
testcase_34 AC 73 ms
71,236 KB
testcase_35 AC 78 ms
75,740 KB
testcase_36 AC 77 ms
75,924 KB
testcase_37 AC 75 ms
71,456 KB
testcase_38 AC 81 ms
76,012 KB
testcase_39 AC 83 ms
75,920 KB
testcase_40 AC 84 ms
75,816 KB
testcase_41 AC 81 ms
75,668 KB
testcase_42 AC 80 ms
75,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def ok(k):
    lst = []
    a, b, x, y = A, B, X, Y
    for i in range(n):
        h = H[i] - k
        if h <= 0:
            continue
        c = h // x
        h -= min(a, c) * x
        a -= min(a, c)
        if h > 0:
            lst.append(h)
    lst.sort(reverse = True)
    lst = lst[a:]
    return sum(lst) <= y * b
    

l = -1
r = 1 << 30
while r - l > 1:
    mid = (l + r) // 2
    if ok(mid):
        r = mid
    else:
        l = mid
print(r)
0