結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー noriocnorioc
提出日時 2024-03-22 23:16:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 131,240 KB
最終ジャッジ日時 2024-03-22 23:16:31
合計ジャッジ時間 11,890 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 WA -
testcase_07 AC 41 ms
59,320 KB
testcase_08 AC 44 ms
59,704 KB
testcase_09 AC 44 ms
59,448 KB
testcase_10 WA -
testcase_11 AC 42 ms
59,320 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 44 ms
59,320 KB
testcase_15 AC 45 ms
59,320 KB
testcase_16 AC 41 ms
59,320 KB
testcase_17 AC 42 ms
59,320 KB
testcase_18 AC 41 ms
59,320 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 41 ms
59,320 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 WA -
testcase_23 AC 40 ms
59,320 KB
testcase_24 AC 82 ms
89,516 KB
testcase_25 AC 81 ms
87,576 KB
testcase_26 AC 87 ms
91,992 KB
testcase_27 AC 99 ms
98,656 KB
testcase_28 AC 104 ms
97,980 KB
testcase_29 AC 65 ms
78,080 KB
testcase_30 WA -
testcase_31 AC 108 ms
98,760 KB
testcase_32 AC 137 ms
102,944 KB
testcase_33 AC 135 ms
103,048 KB
testcase_34 AC 52 ms
66,120 KB
testcase_35 WA -
testcase_36 AC 107 ms
98,660 KB
testcase_37 AC 147 ms
107,108 KB
testcase_38 AC 115 ms
97,744 KB
testcase_39 AC 60 ms
74,820 KB
testcase_40 AC 103 ms
98,724 KB
testcase_41 WA -
testcase_42 AC 50 ms
64,068 KB
testcase_43 AC 53 ms
68,132 KB
testcase_44 AC 149 ms
106,464 KB
testcase_45 AC 145 ms
106,464 KB
testcase_46 AC 80 ms
89,612 KB
testcase_47 AC 80 ms
89,760 KB
testcase_48 AC 108 ms
97,984 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 169 ms
131,112 KB
testcase_55 AC 169 ms
131,188 KB
testcase_56 AC 170 ms
131,240 KB
testcase_57 AC 177 ms
131,116 KB
testcase_58 AC 166 ms
131,120 KB
testcase_59 AC 170 ms
131,116 KB
testcase_60 AC 170 ms
131,240 KB
testcase_61 AC 169 ms
131,120 KB
testcase_62 AC 169 ms
131,112 KB
testcase_63 AC 169 ms
131,112 KB
testcase_64 AC 173 ms
131,120 KB
testcase_65 AC 169 ms
131,116 KB
testcase_66 AC 169 ms
131,112 KB
testcase_67 AC 168 ms
131,116 KB
testcase_68 AC 166 ms
131,116 KB
testcase_69 AC 187 ms
126,768 KB
testcase_70 AC 193 ms
126,764 KB
testcase_71 AC 205 ms
126,760 KB
testcase_72 AC 190 ms
126,712 KB
testcase_73 AC 179 ms
126,768 KB
testcase_74 AC 109 ms
102,624 KB
testcase_75 AC 182 ms
126,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


def calc(m) -> int:
    a = 0
    b = 0
    s = 0
    for i in range(m):
        s += B[i] * (i+1)
        a += A[i]
        b += B[i]

    res = 0
    if s <= H:
        res = a
    for i in range(m, N):
        s -= b
        a -= A[i-m]
        b -= B[i-m]
        s += B[i] * m
        a += A[i]
        b += B[i]
        if s <= H:
            res = max(res, a)
    return res


ans = 0
lo = 1
hi = N
while lo <= hi:
    m = (lo + hi) // 2
    res = calc(m)
    #print(f'{res=} {m=}')
    if res > 0:
        ans = max(ans, res)
        lo = m + 1
    else:
        hi = m - 1

print(ans)
0