結果

問題 No.871 かえるのうた
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-09 14:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 96,112 KB
最終ジャッジ日時 2023-08-20 09:35:07
合計ジャッジ時間 7,708 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,284 KB
testcase_01 AC 79 ms
71,424 KB
testcase_02 AC 79 ms
71,384 KB
testcase_03 AC 78 ms
71,272 KB
testcase_04 AC 78 ms
71,304 KB
testcase_05 AC 78 ms
71,112 KB
testcase_06 AC 77 ms
71,308 KB
testcase_07 AC 78 ms
71,356 KB
testcase_08 AC 83 ms
75,832 KB
testcase_09 AC 82 ms
75,940 KB
testcase_10 AC 84 ms
75,800 KB
testcase_11 AC 82 ms
75,768 KB
testcase_12 AC 90 ms
77,968 KB
testcase_13 AC 83 ms
75,768 KB
testcase_14 AC 132 ms
93,888 KB
testcase_15 AC 125 ms
93,692 KB
testcase_16 AC 136 ms
95,764 KB
testcase_17 AC 122 ms
93,820 KB
testcase_18 AC 87 ms
78,736 KB
testcase_19 AC 134 ms
95,164 KB
testcase_20 AC 88 ms
76,716 KB
testcase_21 AC 111 ms
86,536 KB
testcase_22 AC 78 ms
71,256 KB
testcase_23 AC 77 ms
71,452 KB
testcase_24 AC 77 ms
71,104 KB
testcase_25 AC 85 ms
76,416 KB
testcase_26 AC 89 ms
76,260 KB
testcase_27 AC 86 ms
76,252 KB
testcase_28 AC 79 ms
71,408 KB
testcase_29 AC 107 ms
93,204 KB
testcase_30 AC 128 ms
96,112 KB
testcase_31 AC 83 ms
75,808 KB
testcase_32 AC 124 ms
95,384 KB
testcase_33 AC 129 ms
94,492 KB
testcase_34 AC 94 ms
80,092 KB
testcase_35 AC 108 ms
92,852 KB
testcase_36 AC 115 ms
94,896 KB
testcase_37 AC 106 ms
88,216 KB
testcase_38 AC 134 ms
93,840 KB
testcase_39 AC 124 ms
92,708 KB
testcase_40 AC 102 ms
93,412 KB
testcase_41 AC 73 ms
71,564 KB
testcase_42 AC 102 ms
93,608 KB
testcase_43 AC 74 ms
71,516 KB
testcase_44 AC 80 ms
71,492 KB
testcase_45 AC 84 ms
76,208 KB
testcase_46 AC 79 ms
71,308 KB
testcase_47 AC 77 ms
71,256 KB
testcase_48 AC 79 ms
71,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
X = list(map(int, input().split()))
A = list(map(int, input().split()))

X.sort()

k -= 1

l = k
r = k
ld = X[k]-A[k]
rd = X[k]+A[k]

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