結果

問題 No.2694 The Early Bird Catches The Worm
ユーザー mymelochanmymelochan
提出日時 2024-03-22 21:42:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 169,676 KB
最終ジャッジ日時 2024-03-22 21:42:22
合計ジャッジ時間 12,962 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,596 KB
testcase_01 AC 43 ms
55,596 KB
testcase_02 AC 45 ms
55,596 KB
testcase_03 AC 47 ms
55,596 KB
testcase_04 AC 43 ms
55,596 KB
testcase_05 AC 42 ms
55,596 KB
testcase_06 AC 51 ms
64,280 KB
testcase_07 AC 46 ms
61,516 KB
testcase_08 AC 50 ms
64,152 KB
testcase_09 AC 50 ms
63,756 KB
testcase_10 AC 50 ms
63,632 KB
testcase_11 AC 48 ms
61,516 KB
testcase_12 AC 47 ms
61,516 KB
testcase_13 AC 43 ms
55,596 KB
testcase_14 AC 50 ms
61,644 KB
testcase_15 AC 49 ms
61,644 KB
testcase_16 AC 52 ms
63,904 KB
testcase_17 AC 54 ms
61,644 KB
testcase_18 AC 52 ms
63,884 KB
testcase_19 AC 43 ms
55,596 KB
testcase_20 AC 49 ms
61,644 KB
testcase_21 AC 43 ms
55,596 KB
testcase_22 AC 59 ms
61,516 KB
testcase_23 AC 51 ms
63,884 KB
testcase_24 AC 96 ms
89,620 KB
testcase_25 AC 87 ms
89,696 KB
testcase_26 AC 93 ms
92,264 KB
testcase_27 AC 109 ms
104,268 KB
testcase_28 AC 123 ms
109,100 KB
testcase_29 AC 73 ms
82,420 KB
testcase_30 AC 152 ms
133,388 KB
testcase_31 AC 109 ms
104,528 KB
testcase_32 AC 169 ms
150,212 KB
testcase_33 AC 166 ms
133,904 KB
testcase_34 AC 61 ms
70,484 KB
testcase_35 AC 115 ms
100,504 KB
testcase_36 AC 130 ms
110,856 KB
testcase_37 AC 183 ms
159,924 KB
testcase_38 AC 129 ms
117,864 KB
testcase_39 AC 74 ms
82,732 KB
testcase_40 AC 115 ms
104,480 KB
testcase_41 AC 81 ms
85,788 KB
testcase_42 AC 55 ms
66,360 KB
testcase_43 AC 60 ms
73,144 KB
testcase_44 AC 182 ms
160,232 KB
testcase_45 AC 211 ms
160,108 KB
testcase_46 AC 90 ms
91,500 KB
testcase_47 AC 91 ms
89,644 KB
testcase_48 AC 127 ms
109,100 KB
testcase_49 AC 193 ms
146,768 KB
testcase_50 AC 211 ms
146,896 KB
testcase_51 AC 188 ms
146,768 KB
testcase_52 AC 203 ms
146,896 KB
testcase_53 AC 186 ms
146,856 KB
testcase_54 AC 203 ms
145,356 KB
testcase_55 AC 218 ms
145,288 KB
testcase_56 AC 223 ms
145,352 KB
testcase_57 AC 198 ms
145,352 KB
testcase_58 AC 197 ms
145,352 KB
testcase_59 AC 198 ms
145,352 KB
testcase_60 AC 220 ms
145,352 KB
testcase_61 AC 201 ms
145,356 KB
testcase_62 AC 223 ms
145,348 KB
testcase_63 AC 200 ms
145,352 KB
testcase_64 AC 198 ms
145,356 KB
testcase_65 AC 202 ms
145,356 KB
testcase_66 AC 197 ms
145,344 KB
testcase_67 AC 198 ms
145,352 KB
testcase_68 AC 246 ms
145,352 KB
testcase_69 AC 206 ms
169,672 KB
testcase_70 AC 204 ms
169,676 KB
testcase_71 AC 199 ms
169,672 KB
testcase_72 AC 227 ms
169,672 KB
testcase_73 AC 203 ms
169,672 KB
testcase_74 AC 119 ms
106,496 KB
testcase_75 AC 203 ms
169,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

N,H = lmin()
A = lmin()
B = lmin()

SA = [0]
for a in A:
    SA.append(SA[-1]+a)
SB = [0]
SSB = [0]
for i,b in enumerate(B):
    SB.append(SB[-1]+b*(i+1))
    SSB.append(SSB[-1]+b)

ans = 0
for i in range(N):
    ok = i
    ng = N+1
    while ng-ok > 1:
        cen = (ok+ng)//2
        if SB[cen]-SB[i]-(SSB[cen]-SSB[i])*i <= H:
            ok = cen
        else:
            ng = cen
    ans = max(ans,SA[ok]-SA[i])
print(ans)
0