結果

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

ソースコード

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


for i in range(n*10):
    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])
    nowl = bl
    nowr = br
    pl = l
    pr = r

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