結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー ypwwypww
提出日時 2024-02-15 22:26:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 531 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 48,132 KB
最終ジャッジ日時 2024-02-16 23:35:14
合計ジャッジ時間 22,378 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,112 KB
testcase_01 AC 27 ms
10,112 KB
testcase_02 AC 25 ms
10,112 KB
testcase_03 AC 27 ms
10,112 KB
testcase_04 AC 26 ms
10,112 KB
testcase_05 AC 25 ms
10,112 KB
testcase_06 AC 26 ms
10,240 KB
testcase_07 AC 25 ms
10,112 KB
testcase_08 AC 26 ms
10,240 KB
testcase_09 AC 26 ms
10,112 KB
testcase_10 AC 26 ms
10,112 KB
testcase_11 AC 26 ms
10,112 KB
testcase_12 AC 30 ms
10,112 KB
testcase_13 AC 26 ms
10,112 KB
testcase_14 AC 27 ms
10,112 KB
testcase_15 AC 26 ms
10,112 KB
testcase_16 AC 29 ms
10,112 KB
testcase_17 AC 27 ms
10,112 KB
testcase_18 AC 26 ms
10,112 KB
testcase_19 AC 25 ms
10,112 KB
testcase_20 AC 26 ms
10,112 KB
testcase_21 AC 25 ms
10,112 KB
testcase_22 AC 26 ms
10,112 KB
testcase_23 AC 27 ms
10,112 KB
testcase_24 AC 149 ms
20,208 KB
testcase_25 AC 131 ms
19,096 KB
testcase_26 AC 174 ms
21,784 KB
testcase_27 AC 235 ms
26,272 KB
testcase_28 AC 244 ms
28,532 KB
testcase_29 AC 94 ms
16,052 KB
testcase_30 AC 385 ms
39,544 KB
testcase_31 AC 249 ms
26,624 KB
testcase_32 AC 424 ms
41,204 KB
testcase_33 AC 401 ms
40,136 KB
testcase_34 AC 43 ms
11,520 KB
testcase_35 AC 207 ms
25,688 KB
testcase_36 AC 280 ms
29,828 KB
testcase_37 AC 431 ms
43,984 KB
testcase_38 AC 296 ms
32,408 KB
testcase_39 AC 86 ms
15,160 KB
testcase_40 AC 233 ms
26,596 KB
testcase_41 AC 120 ms
17,612 KB
testcase_42 AC 38 ms
10,752 KB
testcase_43 AC 58 ms
12,672 KB
testcase_44 AC 437 ms
44,272 KB
testcase_45 AC 418 ms
44,264 KB
testcase_46 AC 150 ms
19,968 KB
testcase_47 AC 147 ms
20,712 KB
testcase_48 AC 258 ms
28,540 KB
testcase_49 AC 465 ms
29,468 KB
testcase_50 AC 470 ms
29,356 KB
testcase_51 AC 507 ms
29,352 KB
testcase_52 AC 467 ms
29,444 KB
testcase_53 AC 471 ms
29,444 KB
testcase_54 AC 511 ms
48,132 KB
testcase_55 AC 500 ms
48,132 KB
testcase_56 AC 500 ms
48,132 KB
testcase_57 AC 523 ms
48,132 KB
testcase_58 AC 480 ms
48,132 KB
testcase_59 AC 497 ms
48,132 KB
testcase_60 AC 525 ms
48,132 KB
testcase_61 AC 531 ms
48,132 KB
testcase_62 AC 528 ms
48,132 KB
testcase_63 AC 511 ms
48,132 KB
testcase_64 AC 519 ms
48,132 KB
testcase_65 AC 511 ms
48,132 KB
testcase_66 AC 512 ms
48,132 KB
testcase_67 AC 482 ms
48,132 KB
testcase_68 AC 494 ms
48,132 KB
testcase_69 AC 477 ms
39,552 KB
testcase_70 AC 482 ms
39,552 KB
testcase_71 AC 496 ms
39,552 KB
testcase_72 AC 505 ms
39,552 KB
testcase_73 AC 491 ms
39,552 KB
testcase_74 AC 254 ms
24,812 KB
testcase_75 AC 497 ms
39,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,h = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

suma = [0]
for i in range(n):
    suma.append(suma[-1]+a[i])

sumb = [0]
for i in range(n):
    sumb.append(sumb[-1]+b[i])

now = 0
r = 0
ans = 0
for l in range(n):
    if l!=0:
        now -= sumb[r] - sumb[l-1]
    while r<n and now + (r-l+1)*b[r] <= h:
        now += (r-l+1) * b[r]
        r += 1
    ans = max(ans, suma[r] - suma[l])
print(ans)
0