結果

問題 No.871 かえるのうた
ユーザー 👑 H20H20
提出日時 2021-01-07 12:51:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 102,756 KB
最終ジャッジ日時 2023-08-20 09:37:41
合計ジャッジ時間 7,239 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,280 KB
testcase_01 AC 77 ms
71,464 KB
testcase_02 AC 72 ms
71,340 KB
testcase_03 AC 76 ms
71,340 KB
testcase_04 AC 75 ms
71,372 KB
testcase_05 AC 74 ms
71,460 KB
testcase_06 AC 77 ms
71,148 KB
testcase_07 AC 74 ms
71,364 KB
testcase_08 AC 79 ms
75,704 KB
testcase_09 AC 79 ms
75,632 KB
testcase_10 AC 80 ms
75,640 KB
testcase_11 AC 78 ms
75,744 KB
testcase_12 AC 87 ms
79,140 KB
testcase_13 AC 81 ms
75,908 KB
testcase_14 AC 134 ms
100,296 KB
testcase_15 AC 134 ms
100,876 KB
testcase_16 AC 150 ms
102,756 KB
testcase_17 AC 129 ms
97,876 KB
testcase_18 AC 86 ms
79,576 KB
testcase_19 AC 142 ms
102,032 KB
testcase_20 AC 93 ms
76,916 KB
testcase_21 AC 120 ms
89,716 KB
testcase_22 AC 78 ms
71,352 KB
testcase_23 AC 77 ms
71,532 KB
testcase_24 AC 76 ms
71,172 KB
testcase_25 AC 82 ms
76,196 KB
testcase_26 AC 84 ms
76,388 KB
testcase_27 AC 84 ms
76,752 KB
testcase_28 AC 75 ms
71,236 KB
testcase_29 AC 103 ms
96,640 KB
testcase_30 AC 126 ms
96,580 KB
testcase_31 AC 80 ms
75,688 KB
testcase_32 AC 124 ms
96,948 KB
testcase_33 AC 131 ms
97,300 KB
testcase_34 AC 88 ms
81,652 KB
testcase_35 AC 110 ms
97,680 KB
testcase_36 AC 119 ms
96,152 KB
testcase_37 AC 113 ms
91,460 KB
testcase_38 AC 144 ms
97,756 KB
testcase_39 AC 135 ms
96,256 KB
testcase_40 AC 114 ms
97,168 KB
testcase_41 AC 76 ms
71,368 KB
testcase_42 AC 105 ms
97,300 KB
testcase_43 AC 77 ms
71,344 KB
testcase_44 AC 74 ms
71,448 KB
testcase_45 AC 84 ms
76,640 KB
testcase_46 AC 78 ms
71,340 KB
testcase_47 AC 78 ms
71,544 KB
testcase_48 AC 77 ms
71,336 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