結果

問題 No.871 かえるのうた
ユーザー TakoKurageTakoKurage
提出日時 2019-08-30 23:09:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 28,336 KB
最終ジャッジ日時 2024-05-07 16:26:44
合計ジャッジ時間 5,330 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,624 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 27 ms
10,624 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 AC 24 ms
10,624 KB
testcase_07 AC 26 ms
10,624 KB
testcase_08 AC 28 ms
11,136 KB
testcase_09 AC 30 ms
11,136 KB
testcase_10 AC 27 ms
10,752 KB
testcase_11 AC 28 ms
10,880 KB
testcase_12 AC 46 ms
13,640 KB
testcase_13 AC 31 ms
11,392 KB
testcase_14 AC 143 ms
27,980 KB
testcase_15 AC 144 ms
27,932 KB
testcase_16 AC 234 ms
25,784 KB
testcase_17 AC 136 ms
26,236 KB
testcase_18 AC 46 ms
13,200 KB
testcase_19 AC 150 ms
28,336 KB
testcase_20 AC 46 ms
11,932 KB
testcase_21 AC 84 ms
16,004 KB
testcase_22 AC 28 ms
10,624 KB
testcase_23 AC 26 ms
10,752 KB
testcase_24 AC 27 ms
10,624 KB
testcase_25 AC 32 ms
10,880 KB
testcase_26 AC 48 ms
12,032 KB
testcase_27 AC 43 ms
12,928 KB
testcase_28 AC 27 ms
10,624 KB
testcase_29 AC 87 ms
17,832 KB
testcase_30 AC 187 ms
22,692 KB
testcase_31 AC 28 ms
11,008 KB
testcase_32 AC 154 ms
20,112 KB
testcase_33 AC 136 ms
25,524 KB
testcase_34 AC 55 ms
15,104 KB
testcase_35 AC 94 ms
19,208 KB
testcase_36 AC 117 ms
22,204 KB
testcase_37 AC 114 ms
17,412 KB
testcase_38 AC 229 ms
26,884 KB
testcase_39 AC 219 ms
25,840 KB
testcase_40 AC 152 ms
17,824 KB
testcase_41 AC 28 ms
10,624 KB
testcase_42 AC 160 ms
17,944 KB
testcase_43 AC 25 ms
10,752 KB
testcase_44 AC 24 ms
10,624 KB
testcase_45 AC 29 ms
10,880 KB
testcase_46 AC 25 ms
10,624 KB
testcase_47 AC 26 ms
10,624 KB
testcase_48 AC 27 ms
10,624 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