結果

問題 No.871 かえるのうた
ユーザー yomo3yomo3
提出日時 2020-02-26 14:38:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 28,184 KB
最終ジャッジ日時 2023-08-03 18:14:04
合計ジャッジ時間 6,925 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,632 KB
testcase_01 AC 19 ms
8,492 KB
testcase_02 AC 19 ms
8,540 KB
testcase_03 AC 18 ms
8,580 KB
testcase_04 AC 19 ms
8,504 KB
testcase_05 AC 18 ms
8,560 KB
testcase_06 AC 18 ms
8,580 KB
testcase_07 AC 18 ms
8,592 KB
testcase_08 AC 20 ms
8,956 KB
testcase_09 WA -
testcase_10 AC 19 ms
8,672 KB
testcase_11 AC 19 ms
8,880 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 84 ms
26,424 KB
testcase_15 WA -
testcase_16 AC 159 ms
28,184 KB
testcase_17 AC 75 ms
22,952 KB
testcase_18 AC 28 ms
11,232 KB
testcase_19 WA -
testcase_20 AC 30 ms
10,060 KB
testcase_21 WA -
testcase_22 AC 19 ms
8,548 KB
testcase_23 AC 18 ms
8,580 KB
testcase_24 AC 18 ms
8,692 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 18 ms
8,640 KB
testcase_29 AC 47 ms
15,580 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 97 ms
18,844 KB
testcase_33 WA -
testcase_34 AC 32 ms
12,768 KB
testcase_35 AC 54 ms
18,220 KB
testcase_36 AC 66 ms
21,284 KB
testcase_37 WA -
testcase_38 AC 143 ms
24,748 KB
testcase_39 AC 135 ms
22,428 KB
testcase_40 WA -
testcase_41 AC 19 ms
8,576 KB
testcase_42 AC 90 ms
16,124 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 18 ms
8,648 KB
testcase_47 AC 18 ms
8,692 KB
testcase_48 AC 18 ms
8,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
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()))
K -= 1

q = deque()
q.append(K)
lk = rk = K
l = r = X[K]
while len(q):
    k = q.popleft()
    _l = X[k] - A[k]
    _r = X[k] + A[k]

    if _l < l:
        _lk = bisect_left(X, _l)
        if _lk < lk:
            for i in range(lk-1, _lk-1, -1):
                q.append(i)
            lk = _lk
        l = _l

    if _r > r:
        _rk = bisect_right(X, _r)
        if _rk > rk:
            for i in range(rk+1, _rk):
                q.append(i)
            rk = _rk
        r = _r

print(rk - lk or 1)
0