結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 37 ms
53,460 KB
testcase_04 AC 40 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 51 ms
62,236 KB
testcase_07 AC 42 ms
59,588 KB
testcase_08 AC 50 ms
62,236 KB
testcase_09 AC 45 ms
61,960 KB
testcase_10 AC 46 ms
61,832 KB
testcase_11 AC 49 ms
59,588 KB
testcase_12 AC 41 ms
59,588 KB
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 44 ms
61,832 KB
testcase_15 AC 45 ms
61,840 KB
testcase_16 AC 48 ms
61,976 KB
testcase_17 AC 45 ms
61,832 KB
testcase_18 AC 48 ms
61,972 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 45 ms
61,832 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 AC 42 ms
59,588 KB
testcase_23 AC 47 ms
61,972 KB
testcase_24 AC 85 ms
91,436 KB
testcase_25 AC 84 ms
87,676 KB
testcase_26 AC 90 ms
94,296 KB
testcase_27 AC 104 ms
98,656 KB
testcase_28 AC 121 ms
97,848 KB
testcase_29 AC 69 ms
79,440 KB
testcase_30 AC 142 ms
107,660 KB
testcase_31 AC 104 ms
98,760 KB
testcase_32 AC 149 ms
108,312 KB
testcase_33 AC 146 ms
108,284 KB
testcase_34 AC 51 ms
66,480 KB
testcase_35 AC 126 ms
97,368 KB
testcase_36 AC 116 ms
98,652 KB
testcase_37 AC 159 ms
112,984 KB
testcase_38 AC 123 ms
98,144 KB
testcase_39 AC 64 ms
78,120 KB
testcase_40 AC 116 ms
98,724 KB
testcase_41 AC 78 ms
82,876 KB
testcase_42 AC 51 ms
64,432 KB
testcase_43 AC 56 ms
70,604 KB
testcase_44 AC 161 ms
112,212 KB
testcase_45 AC 160 ms
112,212 KB
testcase_46 AC 93 ms
91,400 KB
testcase_47 AC 92 ms
91,680 KB
testcase_48 AC 110 ms
97,848 KB
testcase_49 AC 191 ms
112,668 KB
testcase_50 AC 205 ms
112,668 KB
testcase_51 AC 186 ms
112,668 KB
testcase_52 AC 206 ms
112,668 KB
testcase_53 AC 179 ms
112,688 KB
testcase_54 AC 212 ms
139,760 KB
testcase_55 AC 215 ms
139,756 KB
testcase_56 AC 214 ms
139,756 KB
testcase_57 AC 213 ms
139,756 KB
testcase_58 AC 211 ms
139,760 KB
testcase_59 AC 210 ms
139,756 KB
testcase_60 AC 212 ms
139,756 KB
testcase_61 AC 236 ms
139,764 KB
testcase_62 AC 211 ms
139,756 KB
testcase_63 AC 211 ms
139,760 KB
testcase_64 AC 210 ms
139,760 KB
testcase_65 AC 212 ms
139,656 KB
testcase_66 AC 237 ms
139,756 KB
testcase_67 AC 211 ms
139,756 KB
testcase_68 AC 211 ms
139,756 KB
testcase_69 AC 189 ms
133,104 KB
testcase_70 AC 189 ms
133,104 KB
testcase_71 AC 187 ms
133,100 KB
testcase_72 AC 189 ms
133,104 KB
testcase_73 AC 190 ms
133,108 KB
testcase_74 AC 114 ms
102,752 KB
testcase_75 AC 202 ms
133,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def isok(r):
    tmp=B[r]-B[l-1]-(B2[r]-B2[l-1])*l
    if tmp<=H:
        return True
    return False

N,H=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
for i in range(N-1):
    A[i+1]+=A[i]
A+=[0]
B2=B[::]
B=[B[i]*(i+1) for i in range(N)]
for i in range(N-1):
    B[i+1]+=B[i]
    B2[i+1]+=B2[i]
B2+=[0]
B+=[0]
ans=0
for l in range(N):
    left,right=l-1,N
    while right-left>1:
        mid=(right+left)//2
        if isok(mid):
            left=mid
        else:
            right=mid
    ans=max(A[left]-A[l-1],ans)
    #print(l,left,A[left]-A[l-1],B[left]-B[l-1]-(B2[left]-B2[l-1])*l)
print(ans)
0