結果

問題 No.871 かえるのうた
ユーザー TakoKurageTakoKurage
提出日時 2019-08-30 23:09:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 24,552 KB
最終ジャッジ日時 2023-08-20 09:22:34
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,908 KB
testcase_01 AC 17 ms
7,856 KB
testcase_02 AC 17 ms
7,944 KB
testcase_03 AC 17 ms
7,804 KB
testcase_04 AC 17 ms
7,812 KB
testcase_05 AC 17 ms
7,816 KB
testcase_06 AC 17 ms
7,840 KB
testcase_07 AC 17 ms
7,864 KB
testcase_08 AC 20 ms
8,516 KB
testcase_09 AC 20 ms
8,448 KB
testcase_10 AC 18 ms
8,184 KB
testcase_11 AC 18 ms
8,196 KB
testcase_12 AC 36 ms
11,192 KB
testcase_13 AC 22 ms
8,672 KB
testcase_14 AC 125 ms
24,092 KB
testcase_15 AC 124 ms
24,112 KB
testcase_16 AC 230 ms
24,552 KB
testcase_17 AC 117 ms
22,584 KB
testcase_18 AC 36 ms
10,968 KB
testcase_19 AC 132 ms
24,120 KB
testcase_20 AC 33 ms
9,572 KB
testcase_21 AC 70 ms
13,936 KB
testcase_22 AC 16 ms
7,856 KB
testcase_23 AC 16 ms
7,820 KB
testcase_24 AC 16 ms
7,808 KB
testcase_25 AC 22 ms
8,460 KB
testcase_26 AC 39 ms
9,460 KB
testcase_27 AC 32 ms
10,624 KB
testcase_28 AC 16 ms
7,780 KB
testcase_29 AC 71 ms
15,200 KB
testcase_30 AC 178 ms
20,112 KB
testcase_31 AC 18 ms
8,424 KB
testcase_32 AC 143 ms
18,444 KB
testcase_33 AC 122 ms
24,084 KB
testcase_34 AC 44 ms
12,180 KB
testcase_35 AC 79 ms
18,020 KB
testcase_36 AC 100 ms
21,112 KB
testcase_37 AC 106 ms
15,108 KB
testcase_38 AC 224 ms
24,108 KB
testcase_39 AC 205 ms
23,360 KB
testcase_40 AC 139 ms
15,724 KB
testcase_41 AC 16 ms
7,856 KB
testcase_42 AC 141 ms
15,724 KB
testcase_43 AC 16 ms
7,896 KB
testcase_44 AC 16 ms
7,860 KB
testcase_45 AC 20 ms
8,280 KB
testcase_46 AC 16 ms
7,744 KB
testcase_47 AC 16 ms
7,900 KB
testcase_48 AC 16 ms
7,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

left = right = K - 1

lower = X[left] - A[left]
upper = X[right] + A[right]

for _ in range(N):
    while 0 < left and lower <= X[left - 1]:
        left -= 1
        upper = max(upper, X[left] + A[left])
        lower = min(lower, X[left] - A[left])
    while right < N - 1 and X[right + 1] <= upper:
        right += 1
        upper = max(upper, X[right] + A[right])
        lower = min(lower, X[right] - A[right])

print(right - left + 1)
0