結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー HydruHydru
提出日時 2021-11-12 22:27:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 3,000 ms
コード長 542 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 110,864 KB
最終ジャッジ日時 2024-05-04 09:36:16
合計ジャッジ時間 6,965 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 208 ms
109,164 KB
testcase_05 AC 158 ms
100,996 KB
testcase_06 AC 119 ms
110,864 KB
testcase_07 AC 38 ms
53,040 KB
testcase_08 AC 104 ms
92,656 KB
testcase_09 AC 128 ms
106,284 KB
testcase_10 AC 121 ms
85,504 KB
testcase_11 AC 110 ms
82,432 KB
testcase_12 AC 65 ms
66,688 KB
testcase_13 AC 149 ms
90,880 KB
testcase_14 AC 146 ms
92,544 KB
testcase_15 AC 198 ms
104,472 KB
testcase_16 AC 133 ms
81,824 KB
testcase_17 AC 135 ms
87,324 KB
testcase_18 AC 114 ms
90,732 KB
testcase_19 AC 116 ms
90,112 KB
testcase_20 AC 82 ms
76,680 KB
testcase_21 AC 152 ms
106,624 KB
testcase_22 AC 193 ms
103,004 KB
testcase_23 AC 199 ms
104,308 KB
testcase_24 AC 183 ms
101,628 KB
testcase_25 AC 158 ms
100,480 KB
testcase_26 AC 201 ms
105,196 KB
testcase_27 AC 166 ms
100,472 KB
testcase_28 AC 207 ms
106,180 KB
testcase_29 AC 178 ms
100,784 KB
testcase_30 AC 217 ms
109,192 KB
testcase_31 AC 211 ms
109,552 KB
testcase_32 AC 164 ms
99,920 KB
testcase_33 AC 52 ms
60,196 KB
testcase_34 AC 39 ms
53,544 KB
testcase_35 AC 47 ms
60,572 KB
testcase_36 AC 41 ms
53,788 KB
testcase_37 AC 38 ms
53,096 KB
testcase_38 AC 47 ms
61,720 KB
testcase_39 AC 56 ms
61,440 KB
testcase_40 AC 51 ms
60,672 KB
testcase_41 AC 51 ms
60,160 KB
testcase_42 AC 50 ms
60,288 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