結果

問題 No.871 かえるのうた
ユーザー nadarenadare
提出日時 2019-08-30 22:07:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 81,724 KB
実行使用メモリ 98,920 KB
最終ジャッジ日時 2024-05-01 18:08:33
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,568 KB
testcase_01 AC 42 ms
52,224 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 38 ms
52,480 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 40 ms
51,968 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 43 ms
58,880 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 106 ms
93,272 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 90 ms
92,752 KB
testcase_18 AC 50 ms
68,108 KB
testcase_19 WA -
testcase_20 AC 62 ms
74,372 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 38 ms
52,224 KB
testcase_24 AC 40 ms
52,352 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 40 ms
51,968 KB
testcase_29 AC 65 ms
87,168 KB
testcase_30 WA -
testcase_31 AC 43 ms
59,396 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 56 ms
70,776 KB
testcase_35 WA -
testcase_36 AC 88 ms
98,920 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 41 ms
53,008 KB
testcase_42 AC 124 ms
92,540 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 43 ms
52,224 KB
testcase_47 AC 41 ms
52,608 KB
testcase_48 AC 39 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect, bisect_left
def inpl(): return list(map(int, input().split()))

N, K = inpl()
K -= 1
X= inpl()
A = inpl()

l = K
r = K
cl = K + 1
cr = K - 1

while cl > l and cr < r:
    for x in range(cl-1, l-1, -1):
        cl -= 1
        nr = bisect(X, X[x] + A[x]) - 1
        r = min(max(r, nr), N-1)
        nl = bisect_left(X, X[x] - A[x])
        l = max(min(l, nl), 0)
    
    for x in range(cr+1, r+1):
        cr += 1
        nr = bisect(X, X[x] + A[x]) - 1
        r = min(max(r, nr), N-1)
        nl = bisect_left(X, X[x] - A[x])
        l = max(min(l, nl), 0)

print(r-l+1)
0