結果

問題 No.871 かえるのうた
ユーザー ttrttr
提出日時 2020-02-04 20:43:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 24,696 KB
最終ジャッジ日時 2023-08-20 09:33:24
合計ジャッジ時間 4,793 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,792 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 AC 18 ms
7,840 KB
testcase_03 AC 17 ms
7,784 KB
testcase_04 AC 18 ms
7,872 KB
testcase_05 AC 18 ms
7,912 KB
testcase_06 AC 16 ms
7,908 KB
testcase_07 AC 16 ms
7,888 KB
testcase_08 AC 18 ms
8,352 KB
testcase_09 AC 19 ms
8,760 KB
testcase_10 AC 18 ms
8,392 KB
testcase_11 AC 17 ms
8,440 KB
testcase_12 AC 30 ms
11,136 KB
testcase_13 AC 21 ms
8,748 KB
testcase_14 AC 89 ms
24,024 KB
testcase_15 AC 88 ms
23,996 KB
testcase_16 AC 201 ms
24,696 KB
testcase_17 AC 84 ms
22,608 KB
testcase_18 AC 28 ms
10,980 KB
testcase_19 AC 97 ms
24,052 KB
testcase_20 AC 30 ms
9,456 KB
testcase_21 AC 59 ms
13,820 KB
testcase_22 AC 16 ms
7,780 KB
testcase_23 AC 17 ms
7,836 KB
testcase_24 AC 17 ms
7,868 KB
testcase_25 AC 21 ms
8,572 KB
testcase_26 AC 38 ms
9,496 KB
testcase_27 AC 26 ms
10,592 KB
testcase_28 AC 16 ms
7,948 KB
testcase_29 AC 50 ms
15,072 KB
testcase_30 AC 178 ms
20,120 KB
testcase_31 AC 19 ms
8,452 KB
testcase_32 AC 115 ms
18,428 KB
testcase_33 AC 87 ms
24,048 KB
testcase_34 AC 34 ms
12,480 KB
testcase_35 AC 56 ms
17,924 KB
testcase_36 AC 71 ms
20,868 KB
testcase_37 AC 92 ms
15,184 KB
testcase_38 AC 190 ms
24,148 KB
testcase_39 AC 148 ms
23,292 KB
testcase_40 AC 126 ms
15,900 KB
testcase_41 AC 16 ms
7,836 KB
testcase_42 AC 152 ms
15,868 KB
testcase_43 AC 16 ms
7,784 KB
testcase_44 AC 17 ms
7,780 KB
testcase_45 AC 21 ms
8,344 KB
testcase_46 AC 17 ms
7,856 KB
testcase_47 AC 16 ms
7,792 KB
testcase_48 AC 17 ms
7,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

i = K-1
j = K-1
l = X[i]
r = X[j]
while True:
    flag = True
    l = min(l, X[i]-A[i], X[j]-A[j])
    r = max(r, X[i]+A[i], X[j]+A[j])
    if i > 0 and X[i-1] >= l:
        i -= 1
        flag = False
    if j < N-1 and X[j+1] <= r:
        j += 1
        flag = False
    if flag:
        break

print(j-i+1)
0