結果

問題 No.871 かえるのうた
ユーザー AT274_AT274_
提出日時 2019-10-14 21:54:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 561 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 636,928 KB
最終ジャッジ日時 2023-08-26 01:51:41
合計ジャッジ時間 6,864 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,092 KB
testcase_01 AC 14 ms
7,920 KB
testcase_02 AC 14 ms
7,988 KB
testcase_03 AC 13 ms
7,928 KB
testcase_04 AC 14 ms
7,952 KB
testcase_05 AC 13 ms
8,012 KB
testcase_06 AC 14 ms
8,100 KB
testcase_07 AC 14 ms
7,996 KB
testcase_08 AC 15 ms
8,576 KB
testcase_09 AC 16 ms
8,788 KB
testcase_10 AC 58 ms
8,644 KB
testcase_11 AC 14 ms
8,348 KB
testcase_12 AC 33 ms
11,248 KB
testcase_13 AC 24 ms
8,756 KB
testcase_14 AC 72 ms
25,368 KB
testcase_15 AC 72 ms
25,308 KB
testcase_16 MLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right
N, K = map(int, input().split())
X = list(map(int, input().split())) + [10 ** 18]
A = list(map(int, input().split())) + [0]


visited = [0] * N
stack = [K - 1]

while stack:
    fr = stack.pop()
    visited[fr] = 1

    l = bisect_left(X, X[fr] - A[fr])
    r = bisect_right(X, X[fr] + A[fr])

    for to in range(l, fr):
        if visited[to]:
            continue
        stack.append(to)

    for to in range(fr + 1, r):
        if visited[to]:
            continue
        stack.append(to)

print(sum(visited))
0