結果
問題 |
No.871 かえるのうた
|
ユーザー |
![]() |
提出日時 | 2020-06-25 23:27:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 28,924 KB |
最終ジャッジ日時 | 2024-07-03 21:56:24 |
合計ジャッジ時間 | 5,256 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 WA * 6 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n,k=map(int,input().split()) X=[int(i) for i in input().split()] A=[int(i) for i in input().split()] l,r=X[k-1]-A[k-1],X[k-1]+A[k-1] ll,rr=k-1,k-1 while True: if ll-1>=0 and X[ll-1]>=l: l=min(l,X[ll-1]-A[ll-1]) r=max(r,X[ll-1]+A[ll-1]) ll-=1 continue if rr+1<n and X[rr+1]<=r: r=max(r,X[rr+1]+A[rr+1]) l=max(l,X[rr+1]-A[rr+1]) rr+=1 continue else: break print(rr-ll+1)