結果

問題 No.871 かえるのうた
ユーザー rlangevinrlangevin
提出日時 2023-01-18 01:01:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 113,556 KB
最終ジャッジ日時 2023-08-20 09:46:52
合計ジャッジ時間 9,117 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
76,776 KB
testcase_01 AC 106 ms
76,704 KB
testcase_02 AC 105 ms
76,860 KB
testcase_03 AC 105 ms
76,704 KB
testcase_04 AC 106 ms
76,800 KB
testcase_05 AC 105 ms
76,848 KB
testcase_06 AC 108 ms
76,708 KB
testcase_07 AC 107 ms
76,704 KB
testcase_08 AC 109 ms
77,480 KB
testcase_09 AC 107 ms
77,668 KB
testcase_10 AC 107 ms
77,464 KB
testcase_11 AC 110 ms
77,540 KB
testcase_12 AC 116 ms
80,496 KB
testcase_13 AC 109 ms
77,620 KB
testcase_14 AC 164 ms
110,240 KB
testcase_15 AC 165 ms
110,316 KB
testcase_16 AC 195 ms
107,396 KB
testcase_17 AC 157 ms
113,384 KB
testcase_18 AC 113 ms
81,112 KB
testcase_19 AC 176 ms
110,232 KB
testcase_20 AC 124 ms
78,084 KB
testcase_21 AC 151 ms
89,888 KB
testcase_22 AC 108 ms
76,816 KB
testcase_23 AC 108 ms
76,860 KB
testcase_24 AC 108 ms
76,748 KB
testcase_25 AC 119 ms
77,676 KB
testcase_26 AC 124 ms
77,768 KB
testcase_27 AC 114 ms
78,784 KB
testcase_28 AC 108 ms
76,724 KB
testcase_29 AC 136 ms
98,820 KB
testcase_30 AC 160 ms
104,276 KB
testcase_31 AC 110 ms
77,516 KB
testcase_32 AC 168 ms
100,780 KB
testcase_33 AC 160 ms
112,700 KB
testcase_34 AC 117 ms
83,280 KB
testcase_35 AC 137 ms
97,348 KB
testcase_36 AC 151 ms
110,548 KB
testcase_37 AC 151 ms
91,856 KB
testcase_38 AC 186 ms
113,556 KB
testcase_39 AC 174 ms
110,392 KB
testcase_40 AC 151 ms
99,388 KB
testcase_41 AC 104 ms
76,780 KB
testcase_42 AC 140 ms
99,292 KB
testcase_43 AC 106 ms
76,680 KB
testcase_44 AC 107 ms
76,788 KB
testcase_45 AC 114 ms
77,476 KB
testcase_46 AC 107 ms
76,824 KB
testcase_47 AC 106 ms
76,912 KB
testcase_48 AC 108 ms
76,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, K = map(int, input().split())
inf = 10 ** 18
X = [-inf] + list(map(int, input().split())) + [inf]
A = [0] + list(map(int, input().split())) + [0]

Q = deque([K])
left = inf
right = -inf
for i in range(202020):
    s = Q[0]
    left = min(left, X[s] - A[s])
    right = max(right, X[s] + A[s])
    if X[s - 1] >= left:
        Q.appendleft(s - 1)
    b = Q[-1]
    left = min(left, X[b] - A[b])
    right = max(right, X[b] + A[b])
    if X[b + 1] <= right:
        Q.append(b + 1)
print(len(Q))
0