結果

問題 No.871 かえるのうた
ユーザー Mine
提出日時 2020-09-06 22:54:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 707 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 29,092 KB
最終ジャッジ日時 2024-11-29 07:46:15
合計ジャッジ時間 4,864 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n, k = map(int, input().split())
x = list(map(int, input().split()))
a = list(map(int, input().split()))

now = k-1
l = x[now] - a[now]
r = x[now] + a[now]
nowl = k-1
nowr = k-1
pl = 0
pr = 0
allfrog = 0


while True:
    bl = bisect.bisect_left(x, l)
    br = bisect.bisect_right(x, r) - 1
    for now in range(bl, nowl+1):
        l = min(l, x[now] - a[now])
        r = max(r, x[now] + a[now])
    for now in range(br, nowr+1):
        l = min(l, x[now] - a[now])
        r = max(r, x[now] + a[now])
    if bl == nowl and br == nowr and pl == l and pr == r:
        break
    nowl = bl
    nowr = br
    pl = l
    pr = r

ans = 0
print(bisect.bisect_right(x, r) - bisect.bisect_left(x, l))
0