結果

問題 No.871 かえるのうた
ユーザー ああいいああいい
提出日時 2022-05-29 18:00:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 101,640 KB
最終ジャッジ日時 2023-08-20 09:43:25
合計ジャッジ時間 7,366 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,272 KB
testcase_01 AC 72 ms
71,076 KB
testcase_02 AC 73 ms
71,264 KB
testcase_03 AC 73 ms
71,184 KB
testcase_04 AC 72 ms
71,256 KB
testcase_05 AC 72 ms
71,288 KB
testcase_06 AC 72 ms
70,956 KB
testcase_07 AC 73 ms
71,168 KB
testcase_08 AC 76 ms
75,564 KB
testcase_09 AC 76 ms
75,540 KB
testcase_10 AC 75 ms
75,516 KB
testcase_11 AC 76 ms
75,540 KB
testcase_12 AC 84 ms
77,700 KB
testcase_13 AC 81 ms
75,436 KB
testcase_14 AC 127 ms
93,464 KB
testcase_15 AC 123 ms
93,496 KB
testcase_16 AC 154 ms
101,640 KB
testcase_17 AC 122 ms
93,432 KB
testcase_18 AC 83 ms
78,368 KB
testcase_19 AC 130 ms
95,348 KB
testcase_20 AC 85 ms
76,852 KB
testcase_21 AC 109 ms
86,640 KB
testcase_22 AC 71 ms
71,296 KB
testcase_23 AC 73 ms
71,368 KB
testcase_24 AC 72 ms
71,012 KB
testcase_25 AC 82 ms
76,372 KB
testcase_26 AC 82 ms
76,424 KB
testcase_27 AC 78 ms
76,068 KB
testcase_28 AC 71 ms
71,104 KB
testcase_29 AC 97 ms
92,952 KB
testcase_30 AC 121 ms
96,584 KB
testcase_31 AC 74 ms
75,668 KB
testcase_32 AC 118 ms
95,704 KB
testcase_33 AC 120 ms
94,352 KB
testcase_34 AC 83 ms
80,108 KB
testcase_35 AC 100 ms
92,640 KB
testcase_36 AC 109 ms
94,916 KB
testcase_37 AC 110 ms
88,864 KB
testcase_38 AC 139 ms
99,128 KB
testcase_39 AC 134 ms
96,744 KB
testcase_40 AC 105 ms
93,388 KB
testcase_41 AC 73 ms
71,308 KB
testcase_42 AC 107 ms
97,840 KB
testcase_43 AC 73 ms
71,272 KB
testcase_44 AC 72 ms
71,008 KB
testcase_45 AC 80 ms
76,288 KB
testcase_46 AC 72 ms
71,324 KB
testcase_47 AC 73 ms
71,136 KB
testcase_48 AC 73 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

K -= 1
right = K + 1
left = K - 1
stack = [K]
ans = 0
while stack:
    now = stack.pop()
    ans += 1
    r = X[now] + A[now]
    l = X[now] - A[now]
    while right < N and X[right] <= r:
        stack.append(right)
        right += 1
    while left >= 0 and X[left] >= l:
        stack.append(left)
        left -= 1
print(ans)
0