結果

問題 No.871 かえるのうた
コンテスト
ユーザー flippergo
提出日時 2026-02-22 09:01:09
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 562 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 434 ms
コンパイル使用メモリ 82,792 KB
実行使用メモリ 99,044 KB
最終ジャッジ日時 2026-02-22 09:01:17
合計ジャッジ時間 5,828 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from bisect import bisect_left,bisect_right
N,K = map(int,input().split())
X = list(map(int,input().split()))
A = list(map(int,input().split()))
INFTY = 2*10**17
xmax = -INFTY
xmin = INFTY
K -= 1
ind_low = K
ind_high = K
while True:
    if xmin<=X[ind_low]-A[ind_low] and xmax>=X[ind_high]+A[ind_high]:
        break
    if xmin>X[ind_low]-A[ind_low]:
        xmin = X[ind_low]-A[ind_low]
    if xmax<X[ind_high]+A[ind_high]:
        xmax = X[ind_high]+A[ind_high]
    ind_low = bisect_left(X,xmin)
    ind_high = bisect_right(X,xmax)-1
print(ind_high-ind_low+1)
0