結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー Nikkuniku029Nikkuniku029
提出日時 2024-03-22 22:21:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 145,012 KB
最終ジャッジ日時 2024-03-22 22:21:31
合計ジャッジ時間 11,824 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 44 ms
59,444 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 42 ms
59,448 KB
testcase_09 AC 40 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 39 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 40 ms
53,460 KB
testcase_15 AC 40 ms
53,460 KB
testcase_16 AC 39 ms
53,460 KB
testcase_17 AC 39 ms
53,460 KB
testcase_18 AC 40 ms
53,460 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 39 ms
53,460 KB
testcase_23 AC 39 ms
53,460 KB
testcase_24 AC 90 ms
92,468 KB
testcase_25 AC 86 ms
89,880 KB
testcase_26 AC 92 ms
95,064 KB
testcase_27 AC 106 ms
98,656 KB
testcase_28 AC 117 ms
98,000 KB
testcase_29 AC 61 ms
79,420 KB
testcase_30 AC 138 ms
113,184 KB
testcase_31 AC 105 ms
98,760 KB
testcase_32 AC 142 ms
113,580 KB
testcase_33 AC 144 ms
113,688 KB
testcase_34 AC 57 ms
68,436 KB
testcase_35 AC 98 ms
97,376 KB
testcase_36 AC 113 ms
98,676 KB
testcase_37 AC 149 ms
119,284 KB
testcase_38 AC 125 ms
102,292 KB
testcase_39 AC 58 ms
78,000 KB
testcase_40 AC 102 ms
98,724 KB
testcase_41 AC 79 ms
86,148 KB
testcase_42 AC 44 ms
62,088 KB
testcase_43 AC 58 ms
72,556 KB
testcase_44 AC 145 ms
118,508 KB
testcase_45 AC 136 ms
118,252 KB
testcase_46 AC 89 ms
92,308 KB
testcase_47 AC 78 ms
92,576 KB
testcase_48 AC 103 ms
98,000 KB
testcase_49 AC 158 ms
116,440 KB
testcase_50 AC 150 ms
115,924 KB
testcase_51 AC 151 ms
116,436 KB
testcase_52 AC 155 ms
115,924 KB
testcase_53 AC 153 ms
116,484 KB
testcase_54 AC 170 ms
145,004 KB
testcase_55 AC 169 ms
144,748 KB
testcase_56 AC 177 ms
144,876 KB
testcase_57 AC 173 ms
144,880 KB
testcase_58 AC 167 ms
144,756 KB
testcase_59 AC 172 ms
144,752 KB
testcase_60 AC 174 ms
145,008 KB
testcase_61 AC 167 ms
144,628 KB
testcase_62 AC 180 ms
144,752 KB
testcase_63 AC 171 ms
145,008 KB
testcase_64 AC 166 ms
144,876 KB
testcase_65 AC 173 ms
145,012 KB
testcase_66 AC 175 ms
144,756 KB
testcase_67 AC 166 ms
144,752 KB
testcase_68 AC 165 ms
144,752 KB
testcase_69 AC 158 ms
140,276 KB
testcase_70 AC 155 ms
140,272 KB
testcase_71 AC 159 ms
140,272 KB
testcase_72 AC 152 ms
140,144 KB
testcase_73 AC 155 ms
140,272 KB
testcase_74 AC 102 ms
102,520 KB
testcase_75 AC 156 ms
140,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, H = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
from itertools import accumulate

cum = list(accumulate(B, initial=0))
ans = 0
tired = 0
day = 0
r = 0
tmp = 0
for l in range(N):
    while r < N and tired + (day + 1) * B[r] <= H:
        tmp += A[r]
        tired += (day + 1) * B[r]
        day += 1
        r += 1
    ans = max(ans, tmp)
    if l == r:
        r += 1
    else:
        tmp -= A[l]
        tired -= cum[r] - cum[l]
        day -= 1
print(ans)
0