結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 👑 rin204rin204
提出日時 2022-01-23 07:36:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 748 ms / 3,000 ms
コード長 535 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 204,780 KB
最終ジャッジ日時 2024-05-06 17:49:48
合計ジャッジ時間 17,179 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,224 KB
testcase_01 AC 38 ms
51,712 KB
testcase_02 AC 39 ms
51,712 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 584 ms
104,432 KB
testcase_05 AC 737 ms
192,428 KB
testcase_06 AC 267 ms
204,780 KB
testcase_07 AC 40 ms
52,224 KB
testcase_08 AC 404 ms
127,948 KB
testcase_09 AC 510 ms
114,744 KB
testcase_10 AC 211 ms
83,284 KB
testcase_11 AC 228 ms
85,120 KB
testcase_12 AC 59 ms
65,664 KB
testcase_13 AC 478 ms
131,632 KB
testcase_14 AC 546 ms
146,856 KB
testcase_15 AC 614 ms
142,560 KB
testcase_16 AC 221 ms
91,268 KB
testcase_17 AC 365 ms
116,688 KB
testcase_18 AC 274 ms
89,400 KB
testcase_19 AC 137 ms
82,432 KB
testcase_20 AC 194 ms
84,052 KB
testcase_21 AC 382 ms
95,328 KB
testcase_22 AC 571 ms
134,140 KB
testcase_23 AC 637 ms
143,876 KB
testcase_24 AC 705 ms
183,460 KB
testcase_25 AC 578 ms
127,220 KB
testcase_26 AC 700 ms
183,008 KB
testcase_27 AC 656 ms
110,556 KB
testcase_28 AC 744 ms
185,044 KB
testcase_29 AC 641 ms
111,472 KB
testcase_30 AC 600 ms
138,836 KB
testcase_31 AC 748 ms
185,772 KB
testcase_32 AC 711 ms
197,468 KB
testcase_33 AC 47 ms
59,648 KB
testcase_34 AC 40 ms
52,096 KB
testcase_35 AC 45 ms
58,880 KB
testcase_36 AC 43 ms
58,496 KB
testcase_37 AC 39 ms
52,480 KB
testcase_38 AC 49 ms
60,544 KB
testcase_39 AC 50 ms
62,080 KB
testcase_40 AC 49 ms
61,056 KB
testcase_41 AC 50 ms
60,032 KB
testcase_42 AC 46 ms
59,776 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