結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 👑 tamatotamato
提出日時 2021-11-12 21:44:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 781 ms / 3,000 ms
コード長 864 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 87,524 KB
実行使用メモリ 162,604 KB
最終ジャッジ日時 2023-08-17 00:40:03
合計ジャッジ時間 14,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,716 KB
testcase_01 AC 70 ms
71,720 KB
testcase_02 AC 71 ms
71,724 KB
testcase_03 AC 69 ms
71,704 KB
testcase_04 AC 738 ms
134,896 KB
testcase_05 AC 267 ms
139,524 KB
testcase_06 AC 295 ms
162,604 KB
testcase_07 AC 70 ms
71,716 KB
testcase_08 AC 155 ms
103,288 KB
testcase_09 AC 205 ms
119,400 KB
testcase_10 AC 293 ms
105,160 KB
testcase_11 AC 143 ms
98,676 KB
testcase_12 AC 84 ms
76,672 KB
testcase_13 AC 504 ms
111,656 KB
testcase_14 AC 217 ms
122,132 KB
testcase_15 AC 775 ms
137,944 KB
testcase_16 AC 247 ms
95,888 KB
testcase_17 AC 418 ms
106,456 KB
testcase_18 AC 168 ms
104,720 KB
testcase_19 AC 276 ms
116,672 KB
testcase_20 AC 114 ms
88,276 KB
testcase_21 AC 550 ms
118,172 KB
testcase_22 AC 670 ms
123,600 KB
testcase_23 AC 770 ms
132,348 KB
testcase_24 AC 296 ms
143,120 KB
testcase_25 AC 260 ms
138,128 KB
testcase_26 AC 743 ms
132,276 KB
testcase_27 AC 256 ms
138,812 KB
testcase_28 AC 781 ms
137,436 KB
testcase_29 AC 255 ms
138,908 KB
testcase_30 AC 771 ms
137,792 KB
testcase_31 AC 761 ms
136,132 KB
testcase_32 AC 262 ms
138,380 KB
testcase_33 AC 75 ms
76,520 KB
testcase_34 AC 70 ms
71,856 KB
testcase_35 AC 77 ms
76,592 KB
testcase_36 AC 72 ms
76,228 KB
testcase_37 AC 71 ms
71,952 KB
testcase_38 AC 77 ms
76,432 KB
testcase_39 AC 80 ms
76,144 KB
testcase_40 AC 78 ms
76,224 KB
testcase_41 AC 80 ms
76,352 KB
testcase_42 AC 82 ms
76,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    ok = sum(H)
    ng = -1
    mid = (ok + ng) // 2
    while ok - ng > 1:
        HH = [max(0, h - mid) for h in H]
        AA = A
        cnt = 0
        for h in HH:
            cnt += h // X
        if cnt >= AA:
            S = sum(HH) - AA * X
        else:
            HHH = [h % X for h in HH]
            AA -= cnt
            if AA >= N:
                S = 0
            else:
                HHH.sort(reverse=True)
                for i in range(AA):
                    HHH[i] = 0
                S = sum(HHH)
        if S <= B * Y:
            ok = mid
        else:
            ng = mid
        mid = (ok + ng) // 2
    print(ok)


if __name__ == '__main__':
    main()
0