結果

問題 No.871 かえるのうた
ユーザー anagohirame
提出日時 2019-08-30 22:48:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,360 KB
最終ジャッジ日時 2024-11-22 01:47:15
合計ジャッジ時間 5,244 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
x = list(map(int, input().split()))
a = list(map(int, input().split()))
cur_back, cur_front = k-1, k-1
lm, rm = x[k-1]-a[k-1], x[k-1]+a[k-1]
while cur_back > 0 and lm <= x[cur_back-1]:
    cur_back -= 1
    lm = min(lm, x[cur_back]-a[cur_back])
while cur_front < n-1 and rm >= x[cur_front+1]:
    cur_front += 1
    rm = max(rm, x[cur_front]+a[cur_front])
print(cur_front-cur_back+1)
0