結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー HydruHydru
提出日時 2021-11-12 22:27:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 232 ms / 3,000 ms
コード長 542 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 115,092 KB
最終ジャッジ日時 2023-08-17 02:24:36
合計ジャッジ時間 8,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,260 KB
testcase_01 AC 75 ms
71,276 KB
testcase_02 AC 71 ms
71,364 KB
testcase_03 AC 72 ms
71,516 KB
testcase_04 AC 230 ms
110,756 KB
testcase_05 AC 182 ms
102,064 KB
testcase_06 AC 152 ms
115,092 KB
testcase_07 AC 71 ms
71,600 KB
testcase_08 AC 133 ms
89,856 KB
testcase_09 AC 152 ms
98,344 KB
testcase_10 AC 145 ms
86,976 KB
testcase_11 AC 126 ms
83,976 KB
testcase_12 AC 87 ms
76,524 KB
testcase_13 AC 159 ms
92,832 KB
testcase_14 AC 163 ms
95,524 KB
testcase_15 AC 206 ms
105,736 KB
testcase_16 AC 147 ms
83,968 KB
testcase_17 AC 148 ms
89,340 KB
testcase_18 AC 133 ms
89,200 KB
testcase_19 AC 129 ms
89,180 KB
testcase_20 AC 108 ms
83,632 KB
testcase_21 AC 161 ms
97,212 KB
testcase_22 AC 204 ms
105,480 KB
testcase_23 AC 214 ms
105,508 KB
testcase_24 AC 199 ms
102,900 KB
testcase_25 AC 179 ms
101,884 KB
testcase_26 AC 214 ms
106,896 KB
testcase_27 AC 182 ms
102,096 KB
testcase_28 AC 220 ms
107,852 KB
testcase_29 AC 195 ms
102,136 KB
testcase_30 AC 232 ms
110,560 KB
testcase_31 AC 227 ms
111,432 KB
testcase_32 AC 187 ms
101,436 KB
testcase_33 AC 79 ms
76,460 KB
testcase_34 AC 71 ms
71,168 KB
testcase_35 AC 80 ms
76,208 KB
testcase_36 AC 72 ms
71,172 KB
testcase_37 AC 71 ms
71,468 KB
testcase_38 AC 79 ms
76,136 KB
testcase_39 AC 81 ms
76,148 KB
testcase_40 AC 79 ms
76,544 KB
testcase_41 AC 79 ms
76,224 KB
testcase_42 AC 79 ms
76,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A,B,X,Y=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
l=-1
r=max(H)
while(r-l>1):
    mid=(r+l)//2
    Z=[max(x-mid,0) for x in H]
    cnt=A
    for i in range(N):
        if Z[i]>=X:
            if cnt>Z[i]//X:
                cnt-=Z[i]//X
                Z[i]%=X
            else:
                Z[i]-=cnt*X
                cnt=0
                break
    if cnt>0:
        Z.sort(reverse=True)
        for i in range(min(N,cnt)):
            Z[i]=0
    if sum(Z)<=B*Y:
        r=mid
    else:
        l=mid
print(r)
0