結果

問題 No.871 かえるのうた
ユーザー daku9640daku9640
提出日時 2019-08-30 22:30:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 609 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 29,960 KB
最終ジャッジ日時 2024-05-01 18:51:55
合計ジャッジ時間 13,891 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
17,820 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 27 ms
11,136 KB
testcase_09 AC 29 ms
11,392 KB
testcase_10 AC 27 ms
10,880 KB
testcase_11 AC 27 ms
11,008 KB
testcase_12 AC 48 ms
13,952 KB
testcase_13 AC 31 ms
11,648 KB
testcase_14 AC 116 ms
29,664 KB
testcase_15 AC 110 ms
29,720 KB
testcase_16 AC 166 ms
29,004 KB
testcase_17 AC 112 ms
27,984 KB
testcase_18 AC 42 ms
13,612 KB
testcase_19 AC 171 ms
29,960 KB
testcase_20 AC 34 ms
12,340 KB
testcase_21 AC 401 ms
18,136 KB
testcase_22 AC 26 ms
10,752 KB
testcase_23 AC 27 ms
10,752 KB
testcase_24 AC 26 ms
10,752 KB
testcase_25 AC 30 ms
11,136 KB
testcase_26 AC 50 ms
12,416 KB
testcase_27 AC 40 ms
13,184 KB
testcase_28 AC 27 ms
10,752 KB
testcase_29 AC 68 ms
19,004 KB
testcase_30 AC 1,149 ms
24,552 KB
testcase_31 AC 29 ms
11,264 KB
testcase_32 TLE -
testcase_33 AC 119 ms
28,604 KB
testcase_34 AC 51 ms
15,504 KB
testcase_35 AC 78 ms
22,564 KB
testcase_36 AC 94 ms
25,684 KB
testcase_37 AC 325 ms
18,480 KB
testcase_38 AC 679 ms
28,220 KB
testcase_39 TLE -
testcase_40 TLE -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect, insort_left, insort
def solve():
    n, k = map(int, input().split())
    k -= 1
    X = list(map(int, input().split()))
    A = list(map(int, input().split()))
    L = [X[i] - A[i] for i in range(n)]
    R = [X[i] + A[i] for i in range(n)]
    l = r = k
    flg = True
    min_x, max_x = L[l], R[r]
    while flg:
        flg = False
        lt = bisect_left(X, min_x)
        rt = bisect(X, max_x) - 1
        min_x = min(L[lt:rt + 1])
        max_x = max(R[lt:rt + 1])
        if l != lt or r != rt:
            l, r, flg = lt, rt, True
    print(r - l + 1)
solve()
0