結果
| 問題 |
No.2694 The Early Bird Catches The Worm
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2024-03-22 22:20:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 230 ms / 2,000 ms |
| コード長 | 647 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 139,968 KB |
| 最終ジャッジ日時 | 2024-09-30 11:51:36 |
| 合計ジャッジ時間 | 13,247 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 72 |
ソースコード
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)
nikoro256