結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー KudeKude
提出日時 2024-03-22 21:34:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 131,496 KB
最終ジャッジ日時 2024-03-22 21:34:40
合計ジャッジ時間 10,616 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 42 ms
59,444 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 42 ms
59,460 KB
testcase_09 AC 39 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 40 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 AC 38 ms
53,460 KB
testcase_18 AC 39 ms
53,460 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 38 ms
53,460 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 AC 37 ms
53,460 KB
testcase_23 AC 39 ms
53,460 KB
testcase_24 AC 84 ms
89,644 KB
testcase_25 AC 82 ms
87,568 KB
testcase_26 AC 88 ms
92,120 KB
testcase_27 AC 99 ms
98,656 KB
testcase_28 AC 101 ms
98,008 KB
testcase_29 AC 57 ms
76,220 KB
testcase_30 AC 126 ms
102,696 KB
testcase_31 AC 100 ms
98,760 KB
testcase_32 AC 131 ms
103,088 KB
testcase_33 AC 130 ms
103,324 KB
testcase_34 AC 56 ms
68,436 KB
testcase_35 AC 95 ms
97,376 KB
testcase_36 AC 106 ms
98,812 KB
testcase_37 AC 138 ms
107,256 KB
testcase_38 AC 112 ms
97,900 KB
testcase_39 AC 56 ms
75,040 KB
testcase_40 AC 99 ms
98,724 KB
testcase_41 AC 76 ms
84,304 KB
testcase_42 AC 44 ms
62,080 KB
testcase_43 AC 57 ms
70,464 KB
testcase_44 AC 135 ms
106,484 KB
testcase_45 AC 124 ms
106,356 KB
testcase_46 AC 85 ms
89,472 KB
testcase_47 AC 71 ms
87,328 KB
testcase_48 AC 96 ms
98,008 KB
testcase_49 AC 141 ms
113,564 KB
testcase_50 AC 138 ms
113,564 KB
testcase_51 AC 140 ms
113,564 KB
testcase_52 AC 137 ms
113,564 KB
testcase_53 AC 142 ms
113,584 KB
testcase_54 AC 157 ms
131,364 KB
testcase_55 AC 159 ms
131,368 KB
testcase_56 AC 161 ms
131,496 KB
testcase_57 AC 157 ms
131,368 KB
testcase_58 AC 151 ms
131,372 KB
testcase_59 AC 156 ms
131,240 KB
testcase_60 AC 156 ms
131,496 KB
testcase_61 AC 150 ms
131,240 KB
testcase_62 AC 156 ms
131,240 KB
testcase_63 AC 156 ms
131,368 KB
testcase_64 AC 151 ms
131,368 KB
testcase_65 AC 158 ms
131,368 KB
testcase_66 AC 158 ms
131,364 KB
testcase_67 AC 153 ms
131,368 KB
testcase_68 AC 149 ms
131,240 KB
testcase_69 AC 136 ms
126,760 KB
testcase_70 AC 138 ms
126,760 KB
testcase_71 AC 138 ms
126,756 KB
testcase_72 AC 138 ms
126,760 KB
testcase_73 AC 139 ms
126,764 KB
testcase_74 AC 93 ms
102,520 KB
testcase_75 AC 139 ms
126,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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