結果

問題 No.871 かえるのうた
ユーザー 👑 H20H20
提出日時 2021-01-07 12:51:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 99,968 KB
最終ジャッジ日時 2024-05-07 16:41:55
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 40 ms
52,224 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 36 ms
52,224 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 38 ms
51,968 KB
testcase_08 AC 42 ms
59,264 KB
testcase_09 AC 41 ms
59,392 KB
testcase_10 AC 43 ms
58,368 KB
testcase_11 AC 40 ms
58,624 KB
testcase_12 AC 50 ms
68,480 KB
testcase_13 AC 43 ms
60,416 KB
testcase_14 AC 104 ms
97,792 KB
testcase_15 AC 98 ms
97,792 KB
testcase_16 AC 115 ms
98,612 KB
testcase_17 AC 95 ms
97,480 KB
testcase_18 AC 49 ms
69,760 KB
testcase_19 AC 109 ms
98,052 KB
testcase_20 AC 53 ms
67,456 KB
testcase_21 AC 84 ms
88,448 KB
testcase_22 AC 37 ms
52,224 KB
testcase_23 AC 37 ms
52,096 KB
testcase_24 AC 36 ms
51,840 KB
testcase_25 AC 46 ms
60,928 KB
testcase_26 AC 50 ms
64,896 KB
testcase_27 AC 50 ms
65,664 KB
testcase_28 AC 37 ms
51,712 KB
testcase_29 AC 68 ms
90,624 KB
testcase_30 AC 98 ms
99,968 KB
testcase_31 AC 39 ms
58,880 KB
testcase_32 AC 93 ms
99,456 KB
testcase_33 AC 97 ms
98,560 KB
testcase_34 AC 51 ms
72,576 KB
testcase_35 AC 74 ms
92,928 KB
testcase_36 AC 89 ms
99,456 KB
testcase_37 AC 82 ms
89,776 KB
testcase_38 AC 111 ms
97,024 KB
testcase_39 AC 101 ms
97,152 KB
testcase_40 AC 74 ms
92,928 KB
testcase_41 AC 37 ms
52,096 KB
testcase_42 AC 72 ms
91,264 KB
testcase_43 AC 36 ms
51,712 KB
testcase_44 AC 37 ms
52,096 KB
testcase_45 AC 45 ms
60,160 KB
testcase_46 AC 37 ms
51,840 KB
testcase_47 AC 39 ms
51,712 KB
testcase_48 AC 35 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
X = [-float('inf')] + list(map(int,input().split())) + [float('inf')]
A = [0] + list(map(int,input().split())) + [0]
lmin=X[M]-A[M]
rmax=X[M]+A[M]
lindex=M
rindex=M
while lmin<=X[lindex-1] or X[rindex+1]<=rmax:
    if lmin<=X[lindex-1]:
        lindex-=1
        lmin = min(lmin,X[lindex]-A[lindex])
        rmax = max(rmax,X[lindex]+A[lindex])
    if X[rindex+1]<=rmax:
        rindex+=1
        lmin = min(lmin,X[rindex]-A[rindex])
        rmax = max(rmax,X[rindex]+A[rindex])

print(rindex-lindex+1)
0