結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー mkawa2mkawa2
提出日時 2024-03-22 21:49:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 1,060 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 156,944 KB
最終ジャッジ日時 2024-03-22 21:50:12
合計ジャッジ時間 11,352 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 44 ms
59,708 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 45 ms
59,708 KB
testcase_09 AC 40 ms
53,460 KB
testcase_10 AC 40 ms
53,460 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 39 ms
53,460 KB
testcase_16 AC 39 ms
53,460 KB
testcase_17 AC 40 ms
53,460 KB
testcase_18 AC 40 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 41 ms
53,460 KB
testcase_21 AC 39 ms
53,460 KB
testcase_22 AC 39 ms
53,460 KB
testcase_23 AC 39 ms
53,460 KB
testcase_24 AC 88 ms
94,432 KB
testcase_25 AC 80 ms
91,648 KB
testcase_26 AC 87 ms
94,008 KB
testcase_27 AC 108 ms
97,008 KB
testcase_28 AC 105 ms
101,552 KB
testcase_29 AC 68 ms
80,980 KB
testcase_30 AC 146 ms
122,420 KB
testcase_31 AC 103 ms
97,320 KB
testcase_32 AC 145 ms
122,872 KB
testcase_33 AC 139 ms
122,760 KB
testcase_34 AC 51 ms
66,328 KB
testcase_35 AC 97 ms
94,424 KB
testcase_36 AC 114 ms
103,772 KB
testcase_37 AC 154 ms
129,708 KB
testcase_38 AC 117 ms
108,428 KB
testcase_39 AC 64 ms
78,616 KB
testcase_40 AC 102 ms
97,412 KB
testcase_41 AC 70 ms
85,024 KB
testcase_42 AC 49 ms
64,300 KB
testcase_43 AC 57 ms
72,524 KB
testcase_44 AC 153 ms
129,064 KB
testcase_45 AC 151 ms
129,060 KB
testcase_46 AC 78 ms
93,596 KB
testcase_47 AC 85 ms
94,440 KB
testcase_48 AC 106 ms
101,688 KB
testcase_49 AC 153 ms
130,376 KB
testcase_50 AC 149 ms
130,372 KB
testcase_51 AC 152 ms
130,372 KB
testcase_52 AC 151 ms
130,364 KB
testcase_53 AC 155 ms
130,420 KB
testcase_54 AC 177 ms
156,560 KB
testcase_55 AC 170 ms
156,684 KB
testcase_56 AC 169 ms
156,688 KB
testcase_57 AC 171 ms
156,812 KB
testcase_58 AC 166 ms
156,536 KB
testcase_59 AC 172 ms
156,560 KB
testcase_60 AC 172 ms
156,688 KB
testcase_61 AC 199 ms
156,816 KB
testcase_62 AC 170 ms
156,560 KB
testcase_63 AC 175 ms
156,816 KB
testcase_64 AC 170 ms
156,944 KB
testcase_65 AC 175 ms
156,816 KB
testcase_66 AC 173 ms
156,944 KB
testcase_67 AC 192 ms
156,560 KB
testcase_68 AC 170 ms
156,940 KB
testcase_69 AC 158 ms
153,872 KB
testcase_70 AC 157 ms
153,868 KB
testcase_71 AC 158 ms
153,868 KB
testcase_72 AC 159 ms
153,864 KB
testcase_73 AC 159 ms
153,872 KB
testcase_74 AC 96 ms
101,468 KB
testcase_75 AC 164 ms
153,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = -1-(-1 << 31)
# inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

lim=10**18

def cumsum(aa):
    cs=[0]
    for a in aa:cs.append(cs[-1]+a)
    return cs

n,h=LI()
aa=LI()
bb=LI()

sa=cumsum(aa)
sb=cumsum(bb)
ans=0
l=0
s=0
for i in range(n):
    s+=bb[i]*(i+1-l)
    while s>h:
        s-=sb[i+1]-sb[l]
        l+=1
    ans=max(ans,sa[i+1]-sa[l])
print(ans)
0