結果

問題 No.871 かえるのうた
ユーザー 👑 Kazun
提出日時 2020-09-05 19:46:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 99,840 KB
最終ジャッジ日時 2024-11-29 05:58:37
合計ジャッジ時間 4,252 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
inf=float("inf")

X=list(map(int,input().split()))
X=[-inf]+X+[inf]

A=list(map(int,input().split()))
A=[0]+A+[0]


p=K
Left=X[K]-A[K]

while Left<=X[p-1]:
    Left=min(Left,X[p-1]-A[p-1])
    p-=1

q=K
Right=X[K]+A[K]
while X[q+1]<=Right:
    Right=max(Right,X[q+1]+A[q+1])
    q+=1

print(q-p+1)
0