結果

問題 No.871 かえるのうた
ユーザー yakeshibayakeshiba
提出日時 2020-09-23 05:12:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 24,796 KB
最終ジャッジ日時 2023-09-09 14:15:10
合計ジャッジ時間 3,914 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,008 KB
testcase_01 WA -
testcase_02 AC 16 ms
8,004 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,012 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 17 ms
8,448 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 81 ms
24,124 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 76 ms
22,828 KB
testcase_18 AC 26 ms
11,048 KB
testcase_19 WA -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 AC 16 ms
7,972 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 16 ms
8,124 KB
testcase_29 AC 46 ms
15,236 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 32 ms
12,476 KB
testcase_35 WA -
testcase_36 AC 66 ms
20,936 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 17 ms
7,964 KB
testcase_42 RE -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 16 ms
7,956 KB
testcase_47 AC 16 ms
8,044 KB
testcase_48 AC 16 ms
8,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n, k = map(int,input().split())
X = list(map(int,input().split()))
A = list(map(int,input().split()))

r = [0]*n    
r[k-1] = 1

L = [X[k-1]-A[k-1]]
R = [X[k-1]+A[k-1]]
lprev, rprev = n-1, 0
left, right = 0, n-1

while not (lprev <= left and right <= rprev):
    left = bisect.bisect_left(X,min(L))
    right = bisect.bisect_left(X,max(R))
    if X[right] != max(R):
        right -= 1
    L = []
    R = []
    for i in range(left,min(n,right+1)):
        r[i] = 1
        L.append(X[i]-A[i])
        R.append(X[i]+A[i])
    lprev = left
    rprev = right

print(sum(r))
0