結果

問題 No.871 かえるのうた
ユーザー takakintakakin
提出日時 2020-06-25 23:27:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 26,288 KB
最終ジャッジ日時 2023-09-16 23:09:33
合計ジャッジ時間 5,139 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,832 KB
testcase_01 WA -
testcase_02 AC 14 ms
7,764 KB
testcase_03 AC 14 ms
7,784 KB
testcase_04 AC 14 ms
7,828 KB
testcase_05 AC 14 ms
7,912 KB
testcase_06 AC 14 ms
7,776 KB
testcase_07 AC 14 ms
7,772 KB
testcase_08 AC 16 ms
8,552 KB
testcase_09 AC 17 ms
8,548 KB
testcase_10 AC 15 ms
8,216 KB
testcase_11 AC 14 ms
8,296 KB
testcase_12 AC 30 ms
11,044 KB
testcase_13 AC 16 ms
8,824 KB
testcase_14 AC 85 ms
24,144 KB
testcase_15 AC 82 ms
24,196 KB
testcase_16 AC 191 ms
26,288 KB
testcase_17 AC 75 ms
22,832 KB
testcase_18 AC 25 ms
10,940 KB
testcase_19 WA -
testcase_20 AC 27 ms
9,736 KB
testcase_21 AC 53 ms
13,864 KB
testcase_22 AC 14 ms
7,824 KB
testcase_23 AC 13 ms
7,804 KB
testcase_24 AC 14 ms
7,832 KB
testcase_25 AC 18 ms
8,484 KB
testcase_26 AC 31 ms
9,416 KB
testcase_27 AC 24 ms
10,624 KB
testcase_28 AC 14 ms
7,824 KB
testcase_29 AC 45 ms
15,096 KB
testcase_30 AC 134 ms
20,188 KB
testcase_31 AC 17 ms
8,528 KB
testcase_32 AC 109 ms
18,512 KB
testcase_33 AC 78 ms
24,076 KB
testcase_34 AC 29 ms
12,220 KB
testcase_35 AC 51 ms
18,012 KB
testcase_36 AC 64 ms
20,768 KB
testcase_37 AC 83 ms
15,288 KB
testcase_38 AC 180 ms
24,096 KB
testcase_39 WA -
testcase_40 AC 116 ms
16,592 KB
testcase_41 AC 14 ms
7,824 KB
testcase_42 AC 118 ms
16,536 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 14 ms
7,776 KB
testcase_47 AC 15 ms
7,812 KB
testcase_48 AC 14 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
X=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
l,r=X[k-1]-A[k-1],X[k-1]+A[k-1]
ll,rr=k-1,k-1
while True:
  if ll-1>=0 and X[ll-1]>=l:
    l=min(l,X[ll-1]-A[ll-1])
    r=max(r,X[ll-1]+A[ll-1])
    ll-=1
    continue
  if rr+1<n and X[rr+1]<=r:
    r=max(r,X[rr+1]+A[rr+1])
    l=max(l,X[rr+1]-A[rr+1])
    rr+=1
    continue
  else:
    break
print(rr-ll+1)

0