結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー sharusharu
提出日時 2024-03-23 01:38:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 557 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 42,368 KB
最終ジャッジ日時 2024-03-23 01:38:44
合計ジャッジ時間 23,508 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 31 ms
9,984 KB
testcase_02 AC 30 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 30 ms
9,984 KB
testcase_05 AC 29 ms
9,984 KB
testcase_06 AC 31 ms
10,112 KB
testcase_07 AC 29 ms
9,984 KB
testcase_08 AC 31 ms
9,984 KB
testcase_09 AC 30 ms
9,984 KB
testcase_10 AC 30 ms
9,984 KB
testcase_11 AC 29 ms
9,984 KB
testcase_12 AC 28 ms
9,984 KB
testcase_13 AC 29 ms
9,984 KB
testcase_14 AC 30 ms
9,984 KB
testcase_15 AC 30 ms
9,984 KB
testcase_16 AC 30 ms
9,984 KB
testcase_17 AC 29 ms
9,984 KB
testcase_18 AC 30 ms
9,984 KB
testcase_19 AC 29 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 30 ms
9,984 KB
testcase_24 AC 157 ms
17,960 KB
testcase_25 AC 122 ms
17,432 KB
testcase_26 AC 181 ms
19,292 KB
testcase_27 AC 238 ms
22,872 KB
testcase_28 AC 212 ms
24,552 KB
testcase_29 AC 83 ms
15,156 KB
testcase_30 AC 335 ms
33,352 KB
testcase_31 AC 206 ms
23,040 KB
testcase_32 AC 468 ms
34,576 KB
testcase_33 AC 388 ms
34,044 KB
testcase_34 AC 45 ms
11,136 KB
testcase_35 AC 190 ms
21,904 KB
testcase_36 AC 301 ms
25,572 KB
testcase_37 AC 428 ms
37,248 KB
testcase_38 AC 256 ms
29,068 KB
testcase_39 AC 74 ms
14,228 KB
testcase_40 AC 208 ms
23,016 KB
testcase_41 AC 109 ms
16,204 KB
testcase_42 AC 34 ms
10,496 KB
testcase_43 AC 56 ms
11,904 KB
testcase_44 AC 369 ms
39,168 KB
testcase_45 AC 327 ms
39,160 KB
testcase_46 AC 142 ms
18,560 KB
testcase_47 AC 128 ms
18,384 KB
testcase_48 AC 262 ms
24,560 KB
testcase_49 AC 514 ms
22,044 KB
testcase_50 AC 538 ms
22,064 KB
testcase_51 AC 514 ms
22,044 KB
testcase_52 AC 523 ms
22,052 KB
testcase_53 AC 557 ms
21,944 KB
testcase_54 AC 467 ms
42,368 KB
testcase_55 AC 507 ms
42,368 KB
testcase_56 AC 451 ms
42,368 KB
testcase_57 AC 532 ms
42,368 KB
testcase_58 AC 419 ms
42,368 KB
testcase_59 AC 495 ms
42,368 KB
testcase_60 AC 534 ms
42,368 KB
testcase_61 AC 516 ms
42,368 KB
testcase_62 AC 556 ms
42,368 KB
testcase_63 AC 485 ms
42,368 KB
testcase_64 AC 380 ms
42,368 KB
testcase_65 AC 506 ms
42,368 KB
testcase_66 AC 477 ms
42,368 KB
testcase_67 AC 402 ms
42,368 KB
testcase_68 AC 408 ms
42,368 KB
testcase_69 AC 523 ms
32,296 KB
testcase_70 AC 542 ms
32,296 KB
testcase_71 AC 518 ms
32,296 KB
testcase_72 AC 547 ms
32,296 KB
testcase_73 AC 514 ms
32,296 KB
testcase_74 AC 261 ms
21,084 KB
testcase_75 AC 541 ms
32,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
s = [0]
for i in range(n):
    s.append(s[i] + B[i])
ans = 0
a = 0
b = 0
r = 0
for l in range(n):
    while r < n and b + (r - l + 1) * B[r] <= h:
        b += (r - l + 1) * B[r]
        a += A[r]
        r += 1
    if b <= h:
        ans = max(ans, a)
    if l == r:
        r += 1
    else:
        b -= s[r] - s[l]
        a -= A[l]
print(ans)
0