結果

問題 No.871 かえるのうた
ユーザー TakoKurageTakoKurage
提出日時 2019-08-30 23:11:55
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 24,652 KB
最終ジャッジ日時 2023-08-20 09:22:40
合計ジャッジ時間 4,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,848 KB
testcase_01 AC 17 ms
7,784 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 16 ms
7,888 KB
testcase_04 AC 16 ms
7,840 KB
testcase_05 AC 16 ms
7,780 KB
testcase_06 AC 17 ms
7,856 KB
testcase_07 AC 17 ms
7,876 KB
testcase_08 AC 18 ms
8,476 KB
testcase_09 AC 19 ms
8,672 KB
testcase_10 AC 17 ms
8,292 KB
testcase_11 AC 17 ms
8,216 KB
testcase_12 AC 29 ms
10,948 KB
testcase_13 AC 20 ms
8,976 KB
testcase_14 AC 90 ms
23,968 KB
testcase_15 AC 91 ms
24,160 KB
testcase_16 AC 213 ms
24,652 KB
testcase_17 AC 86 ms
22,672 KB
testcase_18 AC 29 ms
10,872 KB
testcase_19 AC 97 ms
24,192 KB
testcase_20 AC 33 ms
9,580 KB
testcase_21 AC 62 ms
13,792 KB
testcase_22 AC 16 ms
7,896 KB
testcase_23 AC 16 ms
7,900 KB
testcase_24 AC 16 ms
7,744 KB
testcase_25 AC 21 ms
8,460 KB
testcase_26 AC 35 ms
9,408 KB
testcase_27 AC 28 ms
10,500 KB
testcase_28 AC 16 ms
7,944 KB
testcase_29 AC 52 ms
15,156 KB
testcase_30 AC 148 ms
20,164 KB
testcase_31 AC 18 ms
8,516 KB
testcase_32 AC 120 ms
18,504 KB
testcase_33 AC 86 ms
24,008 KB
testcase_34 AC 33 ms
12,372 KB
testcase_35 AC 57 ms
17,968 KB
testcase_36 AC 72 ms
20,908 KB
testcase_37 AC 91 ms
15,180 KB
testcase_38 AC 191 ms
24,124 KB
testcase_39 AC 175 ms
23,304 KB
testcase_40 AC 129 ms
16,408 KB
testcase_41 AC 16 ms
7,824 KB
testcase_42 AC 128 ms
15,764 KB
testcase_43 AC 16 ms
7,812 KB
testcase_44 AC 16 ms
7,808 KB
testcase_45 AC 19 ms
8,308 KB
testcase_46 AC 17 ms
7,800 KB
testcase_47 AC 18 ms
7,776 KB
testcase_48 AC 17 ms
7,912 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]

ans = -1
while ans != right - left:
    ans = right - left
    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(ans + 1)
0