結果

問題 No.871 かえるのうた
ユーザー nadarenadare
提出日時 2019-08-30 22:07:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 96,216 KB
最終ジャッジ日時 2023-08-14 05:22:02
合計ジャッジ時間 7,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,304 KB
testcase_01 AC 74 ms
71,484 KB
testcase_02 AC 72 ms
71,348 KB
testcase_03 AC 74 ms
71,588 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 75 ms
71,164 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 77 ms
75,736 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 125 ms
93,744 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 119 ms
93,460 KB
testcase_18 AC 81 ms
78,404 KB
testcase_19 WA -
testcase_20 AC 92 ms
77,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 73 ms
71,172 KB
testcase_24 AC 72 ms
71,412 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 79 ms
71,272 KB
testcase_29 AC 99 ms
93,144 KB
testcase_30 WA -
testcase_31 AC 78 ms
75,808 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 85 ms
80,128 KB
testcase_35 WA -
testcase_36 AC 111 ms
93,228 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 73 ms
71,052 KB
testcase_42 AC 153 ms
93,664 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 71 ms
71,584 KB
testcase_47 AC 73 ms
71,304 KB
testcase_48 AC 72 ms
71,408 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