結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー 👑 hitonanodehitonanode
提出日時 2024-04-05 00:30:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 546 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 42,352 KB
最終ジャッジ日時 2024-04-05 00:31:08
合計ジャッジ時間 25,922 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,856 KB
testcase_01 AC 28 ms
9,856 KB
testcase_02 AC 27 ms
9,856 KB
testcase_03 AC 27 ms
9,856 KB
testcase_04 AC 28 ms
9,984 KB
testcase_05 AC 28 ms
9,856 KB
testcase_06 AC 30 ms
10,112 KB
testcase_07 AC 28 ms
9,984 KB
testcase_08 AC 29 ms
9,984 KB
testcase_09 AC 28 ms
9,984 KB
testcase_10 AC 27 ms
9,984 KB
testcase_11 AC 28 ms
9,984 KB
testcase_12 AC 28 ms
9,856 KB
testcase_13 AC 27 ms
9,856 KB
testcase_14 AC 32 ms
9,984 KB
testcase_15 AC 29 ms
9,984 KB
testcase_16 AC 29 ms
9,984 KB
testcase_17 AC 29 ms
9,984 KB
testcase_18 AC 29 ms
9,984 KB
testcase_19 AC 28 ms
9,984 KB
testcase_20 AC 29 ms
9,984 KB
testcase_21 AC 28 ms
9,984 KB
testcase_22 AC 28 ms
9,984 KB
testcase_23 AC 29 ms
9,984 KB
testcase_24 AC 156 ms
17,928 KB
testcase_25 AC 138 ms
17,036 KB
testcase_26 AC 178 ms
19,272 KB
testcase_27 AC 233 ms
22,856 KB
testcase_28 AC 267 ms
24,536 KB
testcase_29 AC 96 ms
14,628 KB
testcase_30 AC 393 ms
33,340 KB
testcase_31 AC 238 ms
23,024 KB
testcase_32 AC 444 ms
34,560 KB
testcase_33 AC 403 ms
35,564 KB
testcase_34 AC 46 ms
11,008 KB
testcase_35 AC 218 ms
21,888 KB
testcase_36 AC 281 ms
25,556 KB
testcase_37 AC 464 ms
36,836 KB
testcase_38 AC 298 ms
29,052 KB
testcase_39 AC 86 ms
14,212 KB
testcase_40 AC 238 ms
23,004 KB
testcase_41 AC 126 ms
15,932 KB
testcase_42 AC 35 ms
10,368 KB
testcase_43 AC 61 ms
11,904 KB
testcase_44 AC 451 ms
39,148 KB
testcase_45 AC 419 ms
39,140 KB
testcase_46 AC 158 ms
17,760 KB
testcase_47 AC 160 ms
18,416 KB
testcase_48 AC 256 ms
24,544 KB
testcase_49 AC 464 ms
22,028 KB
testcase_50 AC 470 ms
22,048 KB
testcase_51 AC 470 ms
22,028 KB
testcase_52 AC 469 ms
22,036 KB
testcase_53 AC 456 ms
21,928 KB
testcase_54 AC 504 ms
42,352 KB
testcase_55 AC 530 ms
42,352 KB
testcase_56 AC 504 ms
42,352 KB
testcase_57 AC 543 ms
42,352 KB
testcase_58 AC 497 ms
42,352 KB
testcase_59 AC 528 ms
42,352 KB
testcase_60 AC 544 ms
42,352 KB
testcase_61 AC 523 ms
42,352 KB
testcase_62 AC 546 ms
42,352 KB
testcase_63 AC 513 ms
42,352 KB
testcase_64 AC 511 ms
42,352 KB
testcase_65 AC 523 ms
42,352 KB
testcase_66 AC 512 ms
42,352 KB
testcase_67 AC 501 ms
42,352 KB
testcase_68 AC 487 ms
42,352 KB
testcase_69 AC 453 ms
32,284 KB
testcase_70 AC 445 ms
32,284 KB
testcase_71 AC 452 ms
32,284 KB
testcase_72 AC 484 ms
32,284 KB
testcase_73 AC 470 ms
32,284 KB
testcase_74 AC 219 ms
21,068 KB
testcase_75 AC 497 ms
32,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ret = 0

suma = 0
sumb0 = 0
sumb1 = 0

l = 0

for r in range(N):
    # [l, r]
    suma += A[r]

    sumb0 += B[r]
    sumb1 += B[r] * r

    while True:
        # B[l] * 1 + B[l + 1] * 2 + ... + B[r] * (r - l + 1)
        s = sumb1 - sumb0 * (l - 1)
        if s <= H:
            break
        else:
            suma -= A[l]
            sumb0 -= B[l]
            sumb1 -= B[l] * l
            l += 1

    ret = max(ret, suma)

print(ret)
0