結果

問題 No.871 かえるのうた
ユーザー shoooooshooooo
提出日時 2019-11-28 10:05:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 24,596 KB
最終ジャッジ日時 2023-08-20 09:30:53
合計ジャッジ時間 4,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,768 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 15 ms
7,736 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 16 ms
7,740 KB
testcase_05 AC 16 ms
7,708 KB
testcase_06 AC 16 ms
7,784 KB
testcase_07 AC 16 ms
7,740 KB
testcase_08 AC 17 ms
8,464 KB
testcase_09 AC 18 ms
8,512 KB
testcase_10 AC 17 ms
7,804 KB
testcase_11 AC 16 ms
8,232 KB
testcase_12 AC 28 ms
10,948 KB
testcase_13 AC 19 ms
8,728 KB
testcase_14 AC 81 ms
23,976 KB
testcase_15 AC 80 ms
23,932 KB
testcase_16 AC 226 ms
24,596 KB
testcase_17 AC 83 ms
22,660 KB
testcase_18 AC 28 ms
11,016 KB
testcase_19 AC 90 ms
24,184 KB
testcase_20 AC 34 ms
9,596 KB
testcase_21 AC 63 ms
14,364 KB
testcase_22 AC 16 ms
7,780 KB
testcase_23 AC 16 ms
7,896 KB
testcase_24 AC 16 ms
7,952 KB
testcase_25 AC 21 ms
8,380 KB
testcase_26 AC 36 ms
9,400 KB
testcase_27 AC 24 ms
10,608 KB
testcase_28 AC 16 ms
7,816 KB
testcase_29 AC 47 ms
15,084 KB
testcase_30 AC 165 ms
20,104 KB
testcase_31 AC 17 ms
8,628 KB
testcase_32 AC 131 ms
18,392 KB
testcase_33 AC 81 ms
23,944 KB
testcase_34 AC 31 ms
12,148 KB
testcase_35 AC 55 ms
18,028 KB
testcase_36 AC 68 ms
20,976 KB
testcase_37 AC 100 ms
15,200 KB
testcase_38 AC 209 ms
23,948 KB
testcase_39 AC 180 ms
23,220 KB
testcase_40 AC 139 ms
16,428 KB
testcase_41 AC 16 ms
7,776 KB
testcase_42 AC 132 ms
16,412 KB
testcase_43 AC 16 ms
7,888 KB
testcase_44 AC 16 ms
7,764 KB
testcase_45 AC 19 ms
8,348 KB
testcase_46 AC 16 ms
7,896 KB
testcase_47 AC 16 ms
7,804 KB
testcase_48 AC 16 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
r=list(map(int,input().split()))
A=list(map(int,input().split()))
K-=1
left=r[K]-A[K]
right=r[K]+A[K]
updated=True
K1=K
while updated:
  updated=False
  while K1-1>=0 and left<=r[K1-1]<=right:
    updated=True
    left=min(r[K1-1]-A[K1-1],left)
    right=max(r[K1-1]+A[K1-1],right)
    K1-=1
  while K+1<=N-1 and r[K+1]<=right:
    updated=True
    right=max(r[K+1]+A[K+1],right)
    left=min(r[K+1]-A[K+1],left)
    K+=1
print(K-K1+1) 
0