結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー ああいいああいい
提出日時 2021-12-04 10:48:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,643 ms / 3,000 ms
コード長 699 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 19,180 KB
最終ジャッジ日時 2023-09-20 20:58:10
合計ジャッジ時間 22,589 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,748 KB
testcase_01 AC 15 ms
7,776 KB
testcase_02 AC 16 ms
7,824 KB
testcase_03 AC 16 ms
8,156 KB
testcase_04 AC 1,482 ms
18,916 KB
testcase_05 AC 1,116 ms
18,964 KB
testcase_06 AC 134 ms
19,000 KB
testcase_07 AC 16 ms
8,152 KB
testcase_08 AC 442 ms
14,504 KB
testcase_09 AC 726 ms
17,364 KB
testcase_10 AC 590 ms
12,980 KB
testcase_11 AC 45 ms
11,760 KB
testcase_12 AC 69 ms
9,040 KB
testcase_13 AC 79 ms
15,012 KB
testcase_14 AC 810 ms
16,188 KB
testcase_15 AC 1,248 ms
18,872 KB
testcase_16 AC 542 ms
11,812 KB
testcase_17 AC 543 ms
13,572 KB
testcase_18 AC 459 ms
13,448 KB
testcase_19 AC 389 ms
13,456 KB
testcase_20 AC 32 ms
10,836 KB
testcase_21 AC 719 ms
17,140 KB
testcase_22 AC 1,129 ms
17,816 KB
testcase_23 AC 1,244 ms
18,928 KB
testcase_24 AC 1,643 ms
19,180 KB
testcase_25 AC 957 ms
18,852 KB
testcase_26 AC 124 ms
19,048 KB
testcase_27 AC 963 ms
18,904 KB
testcase_28 AC 121 ms
18,968 KB
testcase_29 AC 1,068 ms
18,928 KB
testcase_30 AC 1,548 ms
18,864 KB
testcase_31 AC 130 ms
18,984 KB
testcase_32 AC 107 ms
19,012 KB
testcase_33 AC 17 ms
7,816 KB
testcase_34 AC 16 ms
8,228 KB
testcase_35 AC 16 ms
8,172 KB
testcase_36 AC 16 ms
8,268 KB
testcase_37 AC 16 ms
8,176 KB
testcase_38 AC 19 ms
7,924 KB
testcase_39 AC 23 ms
8,340 KB
testcase_40 AC 18 ms
7,792 KB
testcase_41 AC 19 ms
7,884 KB
testcase_42 AC 17 ms
7,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

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

def check(K):
    l = [max(0,i-K) for i in h]
    count = 0
    i = 0
    while count < A and i < N:
        q = l[i] // X
        if q == 0:break
        q = min(A - count,q)
        count += q
        l[i] -= q * X
        i += 1
    if count < A:
        l.sort(reverse = True)
        for i in range(min(A-count,len(l))):
            l[i] = 0
    return sum(l) <= B * Y

if check(0):
    print(0)
    exit()
start = 0
end = 10 ** 9
while start != end:
    mid = end - (end - start + 1) // 2
    if check(mid):
        end = mid
    else:
        start = mid + 1
print(start)
0