結果

問題 No.871 かえるのうた
ユーザー 👑 rin204rin204
提出日時 2022-01-19 00:30:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 102,460 KB
最終ジャッジ日時 2023-08-20 09:42:23
合計ジャッジ時間 7,683 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,188 KB
testcase_01 AC 78 ms
71,268 KB
testcase_02 AC 77 ms
71,328 KB
testcase_03 AC 78 ms
71,272 KB
testcase_04 AC 79 ms
71,420 KB
testcase_05 AC 80 ms
71,452 KB
testcase_06 AC 82 ms
71,348 KB
testcase_07 AC 78 ms
71,396 KB
testcase_08 AC 81 ms
75,612 KB
testcase_09 AC 81 ms
75,644 KB
testcase_10 AC 80 ms
75,920 KB
testcase_11 AC 81 ms
75,676 KB
testcase_12 AC 87 ms
78,972 KB
testcase_13 AC 82 ms
75,644 KB
testcase_14 AC 135 ms
100,192 KB
testcase_15 AC 137 ms
100,684 KB
testcase_16 AC 146 ms
102,460 KB
testcase_17 AC 131 ms
97,784 KB
testcase_18 AC 89 ms
79,548 KB
testcase_19 AC 141 ms
102,108 KB
testcase_20 AC 89 ms
76,656 KB
testcase_21 AC 112 ms
89,312 KB
testcase_22 AC 78 ms
71,308 KB
testcase_23 AC 77 ms
71,440 KB
testcase_24 AC 80 ms
71,364 KB
testcase_25 AC 85 ms
76,316 KB
testcase_26 AC 87 ms
76,512 KB
testcase_27 AC 87 ms
76,680 KB
testcase_28 AC 79 ms
71,112 KB
testcase_29 AC 108 ms
96,876 KB
testcase_30 AC 125 ms
96,044 KB
testcase_31 AC 81 ms
75,688 KB
testcase_32 AC 123 ms
97,100 KB
testcase_33 AC 132 ms
97,328 KB
testcase_34 AC 91 ms
81,792 KB
testcase_35 AC 111 ms
97,436 KB
testcase_36 AC 122 ms
96,060 KB
testcase_37 AC 112 ms
91,288 KB
testcase_38 AC 139 ms
97,724 KB
testcase_39 AC 137 ms
96,328 KB
testcase_40 AC 109 ms
97,276 KB
testcase_41 AC 78 ms
71,236 KB
testcase_42 AC 107 ms
97,508 KB
testcase_43 AC 84 ms
71,228 KB
testcase_44 AC 79 ms
71,452 KB
testcase_45 AC 84 ms
76,148 KB
testcase_46 AC 79 ms
71,176 KB
testcase_47 AC 79 ms
71,532 KB
testcase_48 AC 80 ms
71,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
X = [-10 ** 20] + list(map(int, input().split())) + [10 ** 20]
A = [0] + list(map(int, input().split())) + [0]

flg = True
min_ = X[k] - A[k]
max_ = X[k] + A[k]
l = k - 1
r = k + 1
while flg:
    flg = False
    while X[l] >= min_:
        min_ = min(min_, X[l] - A[l])
        max_ = max(max_, X[l] + A[l])
        l -= 1
        flg = True
    while X[r] <= max_:
        min_ = min(min_, X[r] - A[r])
        max_ = max(max_, X[r] + A[r])
        r += 1
        flg = True
print(r - l - 1)
    
    
0