結果

問題 No.871 かえるのうた
ユーザー pluto77pluto77
提出日時 2020-06-29 13:29:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 26,156 KB
最終ジャッジ日時 2023-08-20 09:35:34
合計ジャッジ時間 4,970 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 AC 16 ms
7,888 KB
testcase_03 AC 16 ms
7,780 KB
testcase_04 AC 16 ms
7,704 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 17 ms
7,952 KB
testcase_07 AC 17 ms
7,780 KB
testcase_08 AC 18 ms
8,584 KB
testcase_09 AC 18 ms
8,692 KB
testcase_10 AC 17 ms
7,708 KB
testcase_11 AC 16 ms
8,200 KB
testcase_12 AC 27 ms
11,116 KB
testcase_13 AC 19 ms
8,892 KB
testcase_14 AC 81 ms
23,980 KB
testcase_15 AC 80 ms
23,936 KB
testcase_16 AC 207 ms
26,156 KB
testcase_17 AC 75 ms
22,660 KB
testcase_18 AC 26 ms
11,024 KB
testcase_19 AC 86 ms
24,280 KB
testcase_20 AC 32 ms
9,544 KB
testcase_21 AC 61 ms
14,792 KB
testcase_22 AC 17 ms
7,712 KB
testcase_23 AC 17 ms
7,796 KB
testcase_24 AC 16 ms
7,768 KB
testcase_25 AC 21 ms
8,532 KB
testcase_26 AC 37 ms
9,420 KB
testcase_27 AC 27 ms
10,528 KB
testcase_28 AC 16 ms
7,792 KB
testcase_29 AC 46 ms
15,088 KB
testcase_30 AC 151 ms
20,208 KB
testcase_31 AC 18 ms
8,480 KB
testcase_32 AC 122 ms
18,464 KB
testcase_33 AC 80 ms
24,180 KB
testcase_34 AC 31 ms
12,492 KB
testcase_35 AC 52 ms
17,928 KB
testcase_36 AC 66 ms
21,060 KB
testcase_37 AC 94 ms
15,220 KB
testcase_38 AC 193 ms
22,072 KB
testcase_39 AC 174 ms
23,400 KB
testcase_40 AC 130 ms
15,772 KB
testcase_41 AC 16 ms
7,780 KB
testcase_42 AC 125 ms
15,744 KB
testcase_43 AC 16 ms
7,792 KB
testcase_44 AC 16 ms
7,760 KB
testcase_45 AC 19 ms
8,432 KB
testcase_46 AC 16 ms
7,788 KB
testcase_47 AC 16 ms
7,704 KB
testcase_48 AC 16 ms
7,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=list(map(int,input().split()))
k-=1
l=r=k
ld=x[k]-a[k]
rd=x[k]+a[k]
f=True
while f:
 f=False
 while l-1>=0 and ld<=x[l-1]:
  f=True
  l-=1
  ld=min(ld,x[l]-a[l])
  rd=max(rd,x[l]+a[l])
 while r+1<n and rd>=x[r+1]:
  f=True
  r+=1
  ld=min(ld,x[r]-a[r])
  rd=max(rd,x[r]+a[r])
print(r-l+1)
0