結果

問題 No.871 かえるのうた
ユーザー pluto77
提出日時 2020-06-29 13:22:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 364 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,380 KB
最終ジャッジ日時 2024-07-18 11:04:09
合計ジャッジ時間 5,659 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki871

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=list(map(int,input().split()))
k-=1
l=r=k
ld=x[k]-a[k]
rd=x[k]+a[k]
f=True
while f:
 f=False
 while l-1>=0 and ld<=x[l-1]:
  f=True
  l-=1
  ld=min(ld,x[l]-a[l])
  rd=max(rd,x[l]+a[l])
 while r+1<n and rd>=x[r+1]:
  f=True
  r+=1
  ld=min(ld,x[r]-a[r])
  rd=max(rd,x[r]+a[r])
 print(r-l+1)
0