結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー dp_ijkdp_ijk
提出日時 2024-03-23 05:12:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 137,440 KB
最終ジャッジ日時 2024-03-23 05:12:16
合計ジャッジ時間 13,275 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 42 ms
59,204 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 40 ms
59,204 KB
testcase_09 AC 42 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 AC 36 ms
53,460 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 40 ms
53,460 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 AC 37 ms
53,460 KB
testcase_18 AC 38 ms
53,460 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 36 ms
53,460 KB
testcase_22 AC 36 ms
53,456 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 96 ms
91,272 KB
testcase_25 AC 91 ms
89,192 KB
testcase_26 AC 89 ms
92,280 KB
testcase_27 AC 107 ms
94,612 KB
testcase_28 AC 116 ms
103,108 KB
testcase_29 AC 74 ms
83,776 KB
testcase_30 AC 136 ms
118,060 KB
testcase_31 AC 115 ms
94,624 KB
testcase_32 AC 135 ms
117,684 KB
testcase_33 AC 142 ms
117,656 KB
testcase_34 AC 57 ms
70,788 KB
testcase_35 AC 97 ms
92,312 KB
testcase_36 AC 123 ms
106,860 KB
testcase_37 AC 153 ms
123,888 KB
testcase_38 AC 136 ms
112,588 KB
testcase_39 AC 69 ms
81,560 KB
testcase_40 AC 110 ms
94,596 KB
testcase_41 AC 83 ms
85,800 KB
testcase_42 AC 47 ms
64,568 KB
testcase_43 AC 73 ms
76,404 KB
testcase_44 AC 149 ms
122,992 KB
testcase_45 AC 144 ms
122,996 KB
testcase_46 AC 89 ms
91,204 KB
testcase_47 AC 83 ms
91,472 KB
testcase_48 AC 119 ms
102,976 KB
testcase_49 AC 153 ms
133,700 KB
testcase_50 AC 162 ms
133,700 KB
testcase_51 AC 152 ms
133,704 KB
testcase_52 AC 180 ms
133,700 KB
testcase_53 AC 151 ms
133,872 KB
testcase_54 AC 183 ms
121,436 KB
testcase_55 AC 153 ms
121,436 KB
testcase_56 AC 180 ms
121,440 KB
testcase_57 AC 149 ms
121,432 KB
testcase_58 AC 191 ms
121,432 KB
testcase_59 AC 149 ms
121,308 KB
testcase_60 AC 182 ms
121,440 KB
testcase_61 AC 146 ms
121,308 KB
testcase_62 AC 181 ms
121,432 KB
testcase_63 AC 153 ms
121,432 KB
testcase_64 AC 148 ms
121,432 KB
testcase_65 AC 166 ms
121,432 KB
testcase_66 AC 156 ms
121,436 KB
testcase_67 AC 182 ms
121,432 KB
testcase_68 AC 148 ms
121,432 KB
testcase_69 AC 144 ms
137,436 KB
testcase_70 AC 156 ms
137,436 KB
testcase_71 AC 145 ms
137,440 KB
testcase_72 AC 154 ms
137,440 KB
testcase_73 AC 143 ms
137,436 KB
testcase_74 AC 98 ms
95,968 KB
testcase_75 AC 152 ms
137,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N, H = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

A_wa = [0] + [*accumulate(A)]
B_wa = [0] + [*accumulate(B)]

r = 0
cost = 0
cands = []
for l in range(N+1):
   if r < l:
      r = l
      cost = 0
   while r < N and cost + (r-l+1) * B[r] <= H:
      cost += (r-l+1) * B[r]
      r += 1
   cands.append(A_wa[r] - A_wa[l])
   cost -= (B_wa[r] - B_wa[l])

print(max(cands))
0