結果

問題 No.871 かえるのうた
ユーザー yakeshibayakeshiba
提出日時 2020-09-23 05:50:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2023-09-09 15:53:48
合計ジャッジ時間 9,622 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,388 KB
testcase_01 AC 17 ms
8,020 KB
testcase_02 AC 17 ms
8,012 KB
testcase_03 AC 16 ms
7,904 KB
testcase_04 WA -
testcase_05 AC 15 ms
8,048 KB
testcase_06 WA -
testcase_07 AC 15 ms
8,176 KB
testcase_08 AC 18 ms
8,416 KB
testcase_09 AC 18 ms
8,744 KB
testcase_10 WA -
testcase_11 AC 17 ms
8,416 KB
testcase_12 AC 37 ms
10,996 KB
testcase_13 AC 26 ms
8,868 KB
testcase_14 AC 85 ms
24,024 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 76 ms
22,600 KB
testcase_18 AC 27 ms
10,940 KB
testcase_19 AC 615 ms
24,320 KB
testcase_20 WA -
testcase_21 TLE -
testcase_22 WA -
testcase_23 AC 16 ms
8,176 KB
testcase_24 WA -
testcase_25 AC 34 ms
8,576 KB
testcase_26 AC 162 ms
9,832 KB
testcase_27 WA -
testcase_28 AC 15 ms
7,988 KB
testcase_29 AC 45 ms
15,284 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

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 True:
    left = bisect.bisect_left(X,min(L))
    right = min(n-1,bisect.bisect_left(X,max(R)))

    if X[right] != max(R):
        right -= 1
    L = []
    R = []
    for i in range(left,right+1):
        r[i] = 1
        L.append(X[i]-A[i])
        R.append(X[i]+A[i])
    
    tmpl,lprev = lprev, min(left,lprev)
    tmpr,rprev = rprev, min(right,rprev)
    if tmpl == lprev and tmpr == rprev:
        break

print(sum(r))
0