結果

問題 No.871 かえるのうた
ユーザー MineMine
提出日時 2020-09-06 23:15:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 25,608 KB
最終ジャッジ日時 2023-08-20 09:37:15
合計ジャッジ時間 4,788 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,892 KB
testcase_01 AC 18 ms
7,984 KB
testcase_02 AC 17 ms
8,036 KB
testcase_03 AC 17 ms
7,860 KB
testcase_04 AC 17 ms
7,896 KB
testcase_05 AC 16 ms
7,972 KB
testcase_06 AC 16 ms
7,936 KB
testcase_07 AC 16 ms
7,952 KB
testcase_08 AC 18 ms
8,704 KB
testcase_09 AC 19 ms
8,580 KB
testcase_10 AC 17 ms
7,984 KB
testcase_11 AC 17 ms
8,456 KB
testcase_12 AC 28 ms
11,136 KB
testcase_13 AC 19 ms
8,664 KB
testcase_14 AC 82 ms
24,004 KB
testcase_15 AC 81 ms
24,020 KB
testcase_16 AC 207 ms
24,672 KB
testcase_17 AC 77 ms
23,720 KB
testcase_18 AC 28 ms
10,980 KB
testcase_19 AC 90 ms
25,608 KB
testcase_20 AC 32 ms
9,704 KB
testcase_21 AC 60 ms
14,816 KB
testcase_22 AC 16 ms
8,128 KB
testcase_23 AC 16 ms
8,036 KB
testcase_24 AC 16 ms
8,028 KB
testcase_25 AC 21 ms
8,352 KB
testcase_26 AC 35 ms
9,416 KB
testcase_27 AC 26 ms
10,684 KB
testcase_28 AC 16 ms
7,916 KB
testcase_29 AC 47 ms
15,176 KB
testcase_30 AC 163 ms
20,176 KB
testcase_31 AC 18 ms
8,512 KB
testcase_32 AC 124 ms
18,520 KB
testcase_33 AC 80 ms
24,176 KB
testcase_34 AC 32 ms
12,116 KB
testcase_35 AC 53 ms
18,000 KB
testcase_36 AC 66 ms
20,924 KB
testcase_37 AC 94 ms
15,320 KB
testcase_38 AC 195 ms
24,024 KB
testcase_39 AC 169 ms
23,416 KB
testcase_40 AC 128 ms
15,948 KB
testcase_41 AC 16 ms
7,948 KB
testcase_42 AC 134 ms
15,788 KB
testcase_43 AC 16 ms
7,948 KB
testcase_44 AC 17 ms
7,948 KB
testcase_45 AC 20 ms
8,348 KB
testcase_46 AC 17 ms
7,976 KB
testcase_47 AC 16 ms
7,916 KB
testcase_48 AC 16 ms
8,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n, k = map(int, input().split())
x = list(map(int, input().split()))
a = list(map(int, input().split()))

idxl = k-1
idxr = k-1
l = x[k-1]
r = x[k-1]
allfrog = 0

while True:
    if idxl >= 0 and l  <= x[idxl]:
        l = min(l, x[idxl] - a[idxl])
        r = max(r, x[idxl] + a[idxl])
        idxl -= 1
    if idxr < n and r  >= x[idxr]:
        l = min(l, x[idxr] - a[idxr])
        r = max(r, x[idxr] + a[idxr])
        idxr += 1
    if allfrog == idxr-idxl-1:
        print(idxr-idxl-1)
        break
    else:
        allfrog = idxr-idxl-1
0