結果

問題 No.871 かえるのうた
ユーザー toyuzukotoyuzuko
提出日時 2020-05-09 09:51:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 24,560 KB
最終ジャッジ日時 2023-09-18 15:27:25
合計ジャッジ時間 5,758 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 AC 17 ms
7,800 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 15 ms
7,892 KB
testcase_06 WA -
testcase_07 AC 16 ms
7,784 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 16 ms
8,304 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 79 ms
24,020 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 75 ms
22,656 KB
testcase_18 AC 26 ms
11,032 KB
testcase_19 WA -
testcase_20 AC 31 ms
9,508 KB
testcase_21 WA -
testcase_22 AC 16 ms
7,732 KB
testcase_23 AC 15 ms
7,788 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 16 ms
7,760 KB
testcase_29 AC 45 ms
15,188 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 30 ms
12,544 KB
testcase_35 WA -
testcase_36 AC 64 ms
20,692 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 16 ms
7,980 KB
testcase_42 AC 125 ms
16,548 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 15 ms
7,904 KB
testcase_47 AC 15 ms
7,848 KB
testcase_48 AC 16 ms
7,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
X = list(map(int, input().split()))
A = list(map(int, input().split()))

lt = X[K - 1] - A[K - 1]
rt = X[K - 1] + A[K - 1]

lidx = K - 1
ridx = K - 1

while True:
    update = False
    if lidx > 0 and X[lidx - 1] >= lt:
        lidx -= 1
        lt = min(lt, X[lidx] - A[lidx])
        rt = max(rt, X[lidx] - A[lidx])
        update = True
    if ridx < N - 1 and X[ridx + 1] <= rt:
        ridx += 1
        lt = min(lt, X[ridx] - A[ridx])
        rt = max(rt, X[ridx] - A[ridx])
        update = True
    if not update:
        break

print(ridx - lidx + 1)
0