結果

問題 No.871 かえるのうた
ユーザー AT274_AT274_
提出日時 2019-10-14 22:09:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 26,064 KB
最終ジャッジ日時 2023-08-26 02:07:04
合計ジャッジ時間 4,846 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 16 ms
7,892 KB
testcase_03 AC 16 ms
7,756 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 15 ms
7,812 KB
testcase_07 AC 16 ms
7,848 KB
testcase_08 AC 16 ms
8,568 KB
testcase_09 AC 18 ms
8,868 KB
testcase_10 WA -
testcase_11 AC 16 ms
8,540 KB
testcase_12 AC 26 ms
10,988 KB
testcase_13 AC 18 ms
8,864 KB
testcase_14 AC 81 ms
24,120 KB
testcase_15 AC 80 ms
23,928 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 86 ms
24,260 KB
testcase_20 WA -
testcase_21 AC 58 ms
14,844 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 19 ms
8,540 KB
testcase_26 AC 33 ms
9,400 KB
testcase_27 AC 25 ms
10,584 KB
testcase_28 AC 16 ms
7,828 KB
testcase_29 WA -
testcase_30 AC 148 ms
20,172 KB
testcase_31 WA -
testcase_32 AC 117 ms
18,492 KB
testcase_33 AC 76 ms
24,196 KB
testcase_34 WA -
testcase_35 AC 52 ms
18,112 KB
testcase_36 WA -
testcase_37 AC 90 ms
15,300 KB
testcase_38 AC 189 ms
24,340 KB
testcase_39 AC 168 ms
23,516 KB
testcase_40 WA -
testcase_41 AC 15 ms
7,908 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 15 ms
7,800 KB
testcase_47 AC 16 ms
7,852 KB
testcase_48 AC 15 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

l = r = K
ld, rd = X[K - 1] - A[K - 1], X[K - 1] + A[K - 1]


updated = True
while updated:
    updated = False

    while (l - 1 > 0) and (ld <= X[l - 1]):
        updated = True
        l -= 1
        ld = min(ld, X[l] - A[l])
        rd = max(rd, X[l] + A[l])

    while (r + 1 < N) and (rd >= X[r + 1]):
        updated = True
        r += 1
        ld = min(ld, X[r] - A[r])
        rd = max(rd, X[r] + A[r])

print(r - l + 1)
0