結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,208 KB
testcase_01 AC 15 ms
8,204 KB
testcase_02 AC 15 ms
8,068 KB
testcase_03 AC 16 ms
8,016 KB
testcase_04 WA -
testcase_05 AC 17 ms
8,064 KB
testcase_06 WA -
testcase_07 AC 16 ms
8,240 KB
testcase_08 AC 18 ms
8,580 KB
testcase_09 AC 19 ms
8,840 KB
testcase_10 WA -
testcase_11 AC 16 ms
8,508 KB
testcase_12 AC 37 ms
11,060 KB
testcase_13 AC 25 ms
9,000 KB
testcase_14 AC 80 ms
24,288 KB
testcase_15 AC 79 ms
24,100 KB
testcase_16 WA -
testcase_17 AC 74 ms
22,744 KB
testcase_18 AC 26 ms
11,004 KB
testcase_19 AC 592 ms
24,384 KB
testcase_20 WA -
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
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, max(right,rprev)
    if tmpl == lprev and tmpr == rprev:
        break

print(sum(r))
0