結果

問題 No.871 かえるのうた
ユーザー stngstng
提出日時 2022-07-23 16:50:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 619 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 102,996 KB
最終ジャッジ日時 2023-09-18 15:35:42
合計ジャッジ時間 13,837 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,628 KB
testcase_01 AC 100 ms
71,568 KB
testcase_02 AC 101 ms
71,732 KB
testcase_03 AC 101 ms
71,648 KB
testcase_04 AC 101 ms
71,496 KB
testcase_05 AC 100 ms
71,808 KB
testcase_06 AC 100 ms
71,548 KB
testcase_07 AC 101 ms
71,668 KB
testcase_08 AC 113 ms
77,300 KB
testcase_09 AC 113 ms
77,332 KB
testcase_10 AC 125 ms
77,612 KB
testcase_11 AC 110 ms
76,956 KB
testcase_12 AC 130 ms
79,472 KB
testcase_13 AC 125 ms
77,760 KB
testcase_14 AC 158 ms
102,692 KB
testcase_15 AC 161 ms
102,940 KB
testcase_16 AC 1,411 ms
101,904 KB
testcase_17 AC 148 ms
99,124 KB
testcase_18 AC 113 ms
79,208 KB
testcase_19 AC 193 ms
102,996 KB
testcase_20 AC 127 ms
78,048 KB
testcase_21 AC 187 ms
85,080 KB
testcase_22 AC 101 ms
71,652 KB
testcase_23 AC 102 ms
71,728 KB
testcase_24 AC 99 ms
71,388 KB
testcase_25 AC 141 ms
78,688 KB
testcase_26 AC 166 ms
78,916 KB
testcase_27 AC 119 ms
77,676 KB
testcase_28 AC 99 ms
71,740 KB
testcase_29 AC 125 ms
87,988 KB
testcase_30 AC 262 ms
93,480 KB
testcase_31 AC 106 ms
76,836 KB
testcase_32 AC 286 ms
90,812 KB
testcase_33 AC 170 ms
97,680 KB
testcase_34 AC 116 ms
80,200 KB
testcase_35 AC 142 ms
89,516 KB
testcase_36 AC 136 ms
94,908 KB
testcase_37 AC 259 ms
86,564 KB
testcase_38 AC 351 ms
99,544 KB
testcase_39 AC 498 ms
97,316 KB
testcase_40 TLE -
testcase_41 AC 100 ms
71,736 KB
testcase_42 AC 195 ms
90,144 KB
testcase_43 AC 99 ms
71,340 KB
testcase_44 AC 99 ms
71,524 KB
testcase_45 AC 127 ms
77,880 KB
testcase_46 AC 97 ms
71,656 KB
testcase_47 AC 101 ms
71,524 KB
testcase_48 AC 100 ms
71,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import bisect

n,k = map(int,input().split())
x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

ans = [0]*(n)

d = deque()
d.append(k-1)
l = k-1
r = k-1
ans[k-1] = 1

while len(d):
    tmp = d.popleft()
    pos = x[tmp]
    nl = bisect.bisect_left(x,pos-a[tmp])
    nr = bisect.bisect_right(x,pos+a[tmp])
    for i in range(nl,l):
        if ans[i] == 1:
            continue
        d.append(i)
        ans[i] = 1
    for i in range(r,nr):
        if ans[i] == 1:
            continue
        d.append(i)
        ans[i] = 1
    l = nl
    r = nr
print(sum(ans))
0