結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー flygonflygon
提出日時 2024-03-22 21:54:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 131,736 KB
最終ジャッジ日時 2024-03-22 21:55:02
合計ジャッジ時間 10,817 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,720 KB
testcase_01 AC 43 ms
55,720 KB
testcase_02 AC 42 ms
55,720 KB
testcase_03 AC 42 ms
55,720 KB
testcase_04 AC 43 ms
55,720 KB
testcase_05 AC 43 ms
55,720 KB
testcase_06 AC 48 ms
61,660 KB
testcase_07 AC 44 ms
55,720 KB
testcase_08 AC 47 ms
61,660 KB
testcase_09 AC 44 ms
55,720 KB
testcase_10 AC 43 ms
55,720 KB
testcase_11 AC 44 ms
55,720 KB
testcase_12 AC 43 ms
55,720 KB
testcase_13 AC 43 ms
55,720 KB
testcase_14 AC 45 ms
55,720 KB
testcase_15 AC 44 ms
55,720 KB
testcase_16 AC 45 ms
55,720 KB
testcase_17 AC 44 ms
55,720 KB
testcase_18 AC 44 ms
55,720 KB
testcase_19 AC 43 ms
55,720 KB
testcase_20 AC 44 ms
55,720 KB
testcase_21 AC 43 ms
55,720 KB
testcase_22 AC 43 ms
55,720 KB
testcase_23 AC 45 ms
55,720 KB
testcase_24 AC 80 ms
89,224 KB
testcase_25 AC 85 ms
87,288 KB
testcase_26 AC 87 ms
91,520 KB
testcase_27 AC 93 ms
92,916 KB
testcase_28 AC 98 ms
91,972 KB
testcase_29 AC 76 ms
81,400 KB
testcase_30 AC 119 ms
101,684 KB
testcase_31 AC 96 ms
92,536 KB
testcase_32 AC 127 ms
118,180 KB
testcase_33 AC 120 ms
102,456 KB
testcase_34 AC 63 ms
70,648 KB
testcase_35 AC 95 ms
93,636 KB
testcase_36 AC 96 ms
93,988 KB
testcase_37 AC 136 ms
123,732 KB
testcase_38 AC 107 ms
96,768 KB
testcase_39 AC 74 ms
80,188 KB
testcase_40 AC 89 ms
92,740 KB
testcase_41 AC 76 ms
84,020 KB
testcase_42 AC 53 ms
66,516 KB
testcase_43 AC 57 ms
70,580 KB
testcase_44 AC 139 ms
123,900 KB
testcase_45 AC 138 ms
124,020 KB
testcase_46 AC 84 ms
89,092 KB
testcase_47 AC 86 ms
89,416 KB
testcase_48 AC 95 ms
91,844 KB
testcase_49 AC 130 ms
106,056 KB
testcase_50 AC 128 ms
106,064 KB
testcase_51 AC 130 ms
106,056 KB
testcase_52 AC 127 ms
106,072 KB
testcase_53 AC 139 ms
106,104 KB
testcase_54 AC 153 ms
131,608 KB
testcase_55 AC 152 ms
129,804 KB
testcase_56 AC 150 ms
129,808 KB
testcase_57 AC 150 ms
129,936 KB
testcase_58 AC 149 ms
131,736 KB
testcase_59 AC 151 ms
129,808 KB
testcase_60 AC 149 ms
129,808 KB
testcase_61 AC 148 ms
129,936 KB
testcase_62 AC 151 ms
129,808 KB
testcase_63 AC 147 ms
129,684 KB
testcase_64 AC 151 ms
129,804 KB
testcase_65 AC 149 ms
129,932 KB
testcase_66 AC 152 ms
129,932 KB
testcase_67 AC 151 ms
129,808 KB
testcase_68 AC 150 ms
129,808 KB
testcase_69 AC 133 ms
126,736 KB
testcase_70 AC 134 ms
126,736 KB
testcase_71 AC 135 ms
126,736 KB
testcase_72 AC 135 ms
126,732 KB
testcase_73 AC 135 ms
126,732 KB
testcase_74 AC 93 ms
97,304 KB
testcase_75 AC 135 ms
126,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

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

print(ans)
0