結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー dp_ijkdp_ijk
提出日時 2024-03-23 05:09:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 129,880 KB
最終ジャッジ日時 2024-03-23 05:09:29
合計ジャッジ時間 10,021 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
60,264 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 41 ms
59,204 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 41 ms
59,204 KB
testcase_09 AC 44 ms
62,004 KB
testcase_10 AC 42 ms
59,720 KB
testcase_11 AC 42 ms
59,848 KB
testcase_12 AC 41 ms
59,464 KB
testcase_13 AC 42 ms
59,464 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 AC 38 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 39 ms
53,460 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 37 ms
53,460 KB
testcase_23 AC 38 ms
53,460 KB
testcase_24 AC 92 ms
91,272 KB
testcase_25 AC 82 ms
89,064 KB
testcase_26 AC 85 ms
92,280 KB
testcase_27 AC 98 ms
94,484 KB
testcase_28 AC 108 ms
102,984 KB
testcase_29 AC 75 ms
82,608 KB
testcase_30 AC 134 ms
116,652 KB
testcase_31 AC 102 ms
94,624 KB
testcase_32 AC 132 ms
117,684 KB
testcase_33 AC 136 ms
117,780 KB
testcase_34 AC 52 ms
68,696 KB
testcase_35 AC 89 ms
92,312 KB
testcase_36 AC 109 ms
106,864 KB
testcase_37 AC 146 ms
123,760 KB
testcase_38 AC 115 ms
112,588 KB
testcase_39 AC 66 ms
80,556 KB
testcase_40 AC 95 ms
94,464 KB
testcase_41 AC 74 ms
85,808 KB
testcase_42 AC 52 ms
66,648 KB
testcase_43 AC 55 ms
72,796 KB
testcase_44 AC 147 ms
122,988 KB
testcase_45 AC 144 ms
122,996 KB
testcase_46 AC 82 ms
91,460 KB
testcase_47 AC 82 ms
91,216 KB
testcase_48 AC 107 ms
102,976 KB
testcase_49 TLE -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
権限があれば一括ダウンロードができます

ソースコード

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