結果

問題 No.871 かえるのうた
ユーザー roarisroaris
提出日時 2019-08-31 09:56:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 1,090 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 94,756 KB
最終ジャッジ日時 2023-08-20 09:25:56
合計ジャッジ時間 8,203 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,368 KB
testcase_01 AC 75 ms
71,448 KB
testcase_02 AC 75 ms
71,420 KB
testcase_03 AC 74 ms
71,240 KB
testcase_04 AC 74 ms
71,268 KB
testcase_05 AC 75 ms
71,268 KB
testcase_06 AC 73 ms
71,356 KB
testcase_07 AC 73 ms
71,196 KB
testcase_08 AC 77 ms
75,724 KB
testcase_09 AC 84 ms
75,648 KB
testcase_10 AC 83 ms
75,848 KB
testcase_11 AC 83 ms
75,648 KB
testcase_12 AC 88 ms
77,728 KB
testcase_13 AC 83 ms
75,724 KB
testcase_14 AC 130 ms
92,180 KB
testcase_15 AC 129 ms
92,332 KB
testcase_16 AC 148 ms
93,792 KB
testcase_17 AC 128 ms
92,012 KB
testcase_18 AC 85 ms
78,060 KB
testcase_19 AC 135 ms
93,744 KB
testcase_20 AC 92 ms
76,800 KB
testcase_21 AC 120 ms
85,292 KB
testcase_22 AC 79 ms
71,264 KB
testcase_23 AC 78 ms
71,424 KB
testcase_24 AC 76 ms
71,424 KB
testcase_25 AC 84 ms
76,620 KB
testcase_26 AC 85 ms
76,308 KB
testcase_27 AC 82 ms
76,204 KB
testcase_28 AC 75 ms
71,116 KB
testcase_29 AC 100 ms
92,568 KB
testcase_30 AC 124 ms
94,756 KB
testcase_31 AC 83 ms
75,672 KB
testcase_32 AC 124 ms
94,104 KB
testcase_33 AC 126 ms
92,552 KB
testcase_34 AC 89 ms
79,812 KB
testcase_35 AC 104 ms
91,632 KB
testcase_36 AC 115 ms
93,044 KB
testcase_37 AC 111 ms
86,908 KB
testcase_38 AC 146 ms
92,512 KB
testcase_39 AC 134 ms
91,664 KB
testcase_40 AC 110 ms
92,996 KB
testcase_41 AC 83 ms
71,384 KB
testcase_42 AC 105 ms
92,848 KB
testcase_43 AC 79 ms
71,560 KB
testcase_44 AC 77 ms
71,360 KB
testcase_45 AC 85 ms
76,480 KB
testcase_46 AC 78 ms
71,444 KB
testcase_47 AC 77 ms
71,160 KB
testcase_48 AC 78 ms
71,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
K -= 1
X = list(map(int, input().split()))
A = list(map(int, input().split()))
l, r = K, K
ld, rd = X[K] - A[K], X[K] + A[K]
update = True

while update:
    update = False
    
    if l - 1 >= 0 and ld <= X[l-1]:
        update = True
        l -= 1
        ld = min(ld, X[l] - A[l])
        rd = max(rd, X[l] + A[l])
    
    if r + 1 < N and X[r+1] <= rd:
        update = True
        r += 1
        rd = max(rd, X[r] + A[r])
        ld = min(ld, X[r] - A[r])

print(r - l + 1)
0