結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー ニックネームニックネーム
提出日時 2024-03-22 21:58:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 668 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 42,488 KB
最終ジャッジ日時 2024-03-22 21:58:36
合計ジャッジ時間 26,661 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,112 KB
testcase_01 AC 28 ms
10,112 KB
testcase_02 AC 28 ms
10,112 KB
testcase_03 AC 28 ms
10,112 KB
testcase_04 AC 32 ms
10,112 KB
testcase_05 AC 28 ms
10,112 KB
testcase_06 AC 31 ms
10,240 KB
testcase_07 AC 29 ms
10,112 KB
testcase_08 AC 30 ms
10,240 KB
testcase_09 AC 30 ms
10,112 KB
testcase_10 AC 29 ms
10,112 KB
testcase_11 AC 29 ms
10,112 KB
testcase_12 AC 29 ms
10,112 KB
testcase_13 AC 31 ms
10,112 KB
testcase_14 AC 29 ms
10,112 KB
testcase_15 AC 29 ms
10,112 KB
testcase_16 AC 30 ms
10,112 KB
testcase_17 AC 30 ms
10,112 KB
testcase_18 AC 29 ms
10,112 KB
testcase_19 AC 29 ms
10,112 KB
testcase_20 AC 30 ms
10,112 KB
testcase_21 AC 29 ms
10,112 KB
testcase_22 AC 30 ms
10,112 KB
testcase_23 AC 29 ms
10,112 KB
testcase_24 AC 186 ms
18,124 KB
testcase_25 AC 161 ms
17,540 KB
testcase_26 AC 212 ms
19,412 KB
testcase_27 AC 290 ms
22,960 KB
testcase_28 AC 276 ms
24,840 KB
testcase_29 AC 102 ms
14,760 KB
testcase_30 AC 463 ms
35,236 KB
testcase_31 AC 267 ms
23,140 KB
testcase_32 AC 540 ms
34,956 KB
testcase_33 AC 500 ms
35,700 KB
testcase_34 AC 49 ms
11,136 KB
testcase_35 AC 241 ms
22,208 KB
testcase_36 AC 329 ms
25,844 KB
testcase_37 AC 558 ms
37,368 KB
testcase_38 AC 332 ms
27,908 KB
testcase_39 AC 93 ms
14,092 KB
testcase_40 AC 254 ms
23,328 KB
testcase_41 AC 137 ms
16,288 KB
testcase_42 AC 36 ms
10,624 KB
testcase_43 AC 65 ms
12,032 KB
testcase_44 AC 491 ms
39,284 KB
testcase_45 AC 452 ms
39,276 KB
testcase_46 AC 184 ms
17,848 KB
testcase_47 AC 162 ms
18,544 KB
testcase_48 AC 320 ms
24,848 KB
testcase_49 AC 623 ms
27,800 KB
testcase_50 AC 593 ms
26,372 KB
testcase_51 AC 621 ms
27,812 KB
testcase_52 AC 592 ms
27,776 KB
testcase_53 AC 594 ms
27,784 KB
testcase_54 AC 605 ms
40,256 KB
testcase_55 AC 611 ms
42,488 KB
testcase_56 AC 578 ms
40,256 KB
testcase_57 AC 647 ms
40,568 KB
testcase_58 AC 538 ms
40,256 KB
testcase_59 AC 607 ms
40,256 KB
testcase_60 AC 651 ms
40,256 KB
testcase_61 AC 621 ms
40,256 KB
testcase_62 AC 668 ms
40,256 KB
testcase_63 AC 617 ms
40,256 KB
testcase_64 AC 559 ms
40,256 KB
testcase_65 AC 647 ms
40,256 KB
testcase_66 AC 615 ms
40,256 KB
testcase_67 AC 560 ms
40,256 KB
testcase_68 AC 534 ms
40,568 KB
testcase_69 AC 581 ms
32,420 KB
testcase_70 AC 587 ms
32,420 KB
testcase_71 AC 582 ms
32,420 KB
testcase_72 AC 584 ms
32,420 KB
testcase_73 AC 581 ms
32,420 KB
testcase_74 AC 301 ms
21,204 KB
testcase_75 AC 581 ms
32,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,h = map(int,input().split())
a = list(map(int,input().split()))+[0]
b = list(map(int,input().split()))+[0]
for i in range(n,0,-1): a[i-1] += a[i]; b[i-1] += b[i]
k = x = 0; l = r = n
while r>0:
    while l>0 and k+b[l-1]-b[r]<=h: k += b[l-1]-b[r]; l -= 1
    x = max(x,a[l]-a[r]); k -= (b[r-1]-b[r])*(r-l); r -= 1; l = min(l,r)
print(x)
0