結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-03-25 11:25:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 132,992 KB
最終ジャッジ日時 2024-03-25 11:25:53
合計ジャッジ時間 12,828 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 33 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 39 ms
59,448 KB
testcase_07 AC 34 ms
53,460 KB
testcase_08 AC 38 ms
59,448 KB
testcase_09 AC 35 ms
53,460 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 34 ms
53,460 KB
testcase_12 AC 34 ms
53,460 KB
testcase_13 AC 34 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 35 ms
53,460 KB
testcase_16 AC 35 ms
53,460 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 34 ms
53,460 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 35 ms
53,460 KB
testcase_22 AC 36 ms
53,456 KB
testcase_23 AC 36 ms
53,460 KB
testcase_24 AC 80 ms
90,044 KB
testcase_25 AC 77 ms
87,952 KB
testcase_26 AC 83 ms
92,760 KB
testcase_27 AC 96 ms
98,656 KB
testcase_28 AC 96 ms
97,996 KB
testcase_29 AC 70 ms
81,776 KB
testcase_30 AC 149 ms
103,964 KB
testcase_31 AC 91 ms
98,760 KB
testcase_32 AC 121 ms
104,364 KB
testcase_33 AC 120 ms
104,464 KB
testcase_34 AC 54 ms
70,544 KB
testcase_35 AC 95 ms
97,496 KB
testcase_36 AC 100 ms
98,672 KB
testcase_37 AC 123 ms
108,656 KB
testcase_38 AC 104 ms
97,760 KB
testcase_39 AC 68 ms
80,572 KB
testcase_40 AC 110 ms
98,724 KB
testcase_41 AC 71 ms
84,756 KB
testcase_42 AC 45 ms
64,308 KB
testcase_43 AC 50 ms
70,460 KB
testcase_44 AC 126 ms
108,012 KB
testcase_45 AC 127 ms
108,008 KB
testcase_46 AC 77 ms
90,012 KB
testcase_47 AC 76 ms
90,400 KB
testcase_48 AC 90 ms
97,996 KB
testcase_49 AC 129 ms
113,564 KB
testcase_50 AC 130 ms
113,436 KB
testcase_51 AC 135 ms
113,564 KB
testcase_52 AC 127 ms
113,564 KB
testcase_53 AC 130 ms
113,584 KB
testcase_54 AC 150 ms
132,988 KB
testcase_55 AC 147 ms
132,984 KB
testcase_56 AC 144 ms
132,984 KB
testcase_57 AC 157 ms
132,984 KB
testcase_58 AC 152 ms
132,732 KB
testcase_59 AC 146 ms
132,860 KB
testcase_60 AC 153 ms
132,988 KB
testcase_61 AC 150 ms
132,736 KB
testcase_62 AC 146 ms
132,856 KB
testcase_63 AC 143 ms
132,728 KB
testcase_64 AC 144 ms
132,992 KB
testcase_65 AC 142 ms
132,736 KB
testcase_66 AC 149 ms
132,984 KB
testcase_67 AC 148 ms
132,856 KB
testcase_68 AC 145 ms
132,988 KB
testcase_69 AC 128 ms
128,252 KB
testcase_70 AC 130 ms
128,252 KB
testcase_71 AC 131 ms
128,252 KB
testcase_72 AC 131 ms
128,252 KB
testcase_73 AC 128 ms
128,252 KB
testcase_74 AC 93 ms
103,544 KB
testcase_75 AC 130 ms
128,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

S=[0 for _ in range(N+1)]
for i in range(N):S[i+1]=S[i]+B[i]

r=0
len=1
a=A[0]
b=B[0]
ans=0
for l in range(N):
    while r+1<N and b+B[r+1]*(len+1)<=H:
        r+=1
        len+=1
        a+=A[r]
        b+=B[r]*len
    if b<=H:ans=max(ans,a)
    a-=A[l]
    b-=S[r+1]-S[l]
    len-=1
print(ans)
0