結果

問題 No.871 かえるのうた
ユーザー daku9640daku9640
提出日時 2019-08-30 22:33:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 29,972 KB
最終ジャッジ日時 2024-05-01 18:56:36
合計ジャッジ時間 5,047 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 WA -
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 33 ms
10,752 KB
testcase_06 WA -
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 34 ms
11,136 KB
testcase_09 AC 35 ms
11,392 KB
testcase_10 AC 32 ms
11,008 KB
testcase_11 AC 36 ms
11,008 KB
testcase_12 AC 49 ms
13,892 KB
testcase_13 AC 35 ms
11,648 KB
testcase_14 AC 131 ms
29,624 KB
testcase_15 AC 125 ms
28,352 KB
testcase_16 AC 137 ms
29,148 KB
testcase_17 AC 121 ms
27,948 KB
testcase_18 AC 48 ms
13,628 KB
testcase_19 WA -
testcase_20 AC 41 ms
12,476 KB
testcase_21 AC 69 ms
17,316 KB
testcase_22 AC 32 ms
10,752 KB
testcase_23 AC 33 ms
10,880 KB
testcase_24 AC 32 ms
10,752 KB
testcase_25 AC 34 ms
11,136 KB
testcase_26 AC 42 ms
12,288 KB
testcase_27 AC 45 ms
13,184 KB
testcase_28 AC 32 ms
10,752 KB
testcase_29 AC 79 ms
19,168 KB
testcase_30 AC 105 ms
24,180 KB
testcase_31 AC 34 ms
11,392 KB
testcase_32 AC 98 ms
22,996 KB
testcase_33 WA -
testcase_34 AC 55 ms
15,516 KB
testcase_35 AC 86 ms
21,772 KB
testcase_36 AC 109 ms
25,708 KB
testcase_37 AC 73 ms
18,212 KB
testcase_38 AC 130 ms
28,584 KB
testcase_39 WA -
testcase_40 AC 205 ms
19,600 KB
testcase_41 AC 33 ms
10,752 KB
testcase_42 AC 86 ms
20,772 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 32 ms
10,880 KB
testcase_47 AC 31 ms
10,752 KB
testcase_48 AC 33 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

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(min_x, min(L[lt:l + 1] + R[r :rt + 1]))
        max_x = max(max_x, max(L[lt:l + 1] + R[r :rt + 1]))
        if l != lt or r != rt:
            l, r, flg = lt, rt, True
    print(r - l + 1)
solve()
0