結果

問題 No.871 かえるのうた
ユーザー 👑 KazunKazun
提出日時 2020-09-05 20:13:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 102,968 KB
最終ジャッジ日時 2023-08-20 09:36:45
合計ジャッジ時間 7,421 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,376 KB
testcase_01 AC 79 ms
71,116 KB
testcase_02 AC 77 ms
71,444 KB
testcase_03 AC 89 ms
71,616 KB
testcase_04 AC 81 ms
71,248 KB
testcase_05 AC 80 ms
71,452 KB
testcase_06 AC 79 ms
71,308 KB
testcase_07 AC 80 ms
71,628 KB
testcase_08 AC 82 ms
75,804 KB
testcase_09 AC 84 ms
75,732 KB
testcase_10 AC 84 ms
75,768 KB
testcase_11 AC 83 ms
75,768 KB
testcase_12 AC 94 ms
79,080 KB
testcase_13 AC 84 ms
75,768 KB
testcase_14 AC 145 ms
100,264 KB
testcase_15 AC 145 ms
100,588 KB
testcase_16 AC 163 ms
102,968 KB
testcase_17 AC 142 ms
97,968 KB
testcase_18 AC 90 ms
79,580 KB
testcase_19 AC 153 ms
102,220 KB
testcase_20 AC 95 ms
77,064 KB
testcase_21 AC 128 ms
89,252 KB
testcase_22 AC 78 ms
71,444 KB
testcase_23 AC 79 ms
71,252 KB
testcase_24 AC 76 ms
71,456 KB
testcase_25 AC 84 ms
76,476 KB
testcase_26 AC 86 ms
76,504 KB
testcase_27 AC 82 ms
76,728 KB
testcase_28 AC 77 ms
71,252 KB
testcase_29 AC 105 ms
96,992 KB
testcase_30 AC 126 ms
96,116 KB
testcase_31 AC 81 ms
75,740 KB
testcase_32 AC 131 ms
96,988 KB
testcase_33 AC 140 ms
97,512 KB
testcase_34 AC 95 ms
81,752 KB
testcase_35 AC 121 ms
97,624 KB
testcase_36 AC 129 ms
96,200 KB
testcase_37 AC 121 ms
91,120 KB
testcase_38 AC 147 ms
97,828 KB
testcase_39 AC 137 ms
96,372 KB
testcase_40 AC 107 ms
97,516 KB
testcase_41 AC 73 ms
71,360 KB
testcase_42 AC 105 ms
97,076 KB
testcase_43 AC 74 ms
71,120 KB
testcase_44 AC 75 ms
71,300 KB
testcase_45 AC 80 ms
76,296 KB
testcase_46 AC 77 ms
71,268 KB
testcase_47 AC 82 ms
71,640 KB
testcase_48 AC 80 ms
71,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
inf=float("inf")

X=list(map(int,input().split()))
X=[-inf]+X+[inf]

A=list(map(int,input().split()))
A=[0]+A+[0]

s,t=-1,-1

p=q=K
Left =X[K]-A[K]
Right=X[K]+A[K]

while (p,q)!=(s,t):
    s,t=p,q

    if Left<=X[p-1]:
        Left =min(Left ,X[p-1]-A[p-1])
        Right=max(Right,X[p-1]+A[p-1])
        p-=1

    if X[q+1]<=Right:
        Left =min(Left ,X[q+1]-A[q+1])
        Right=max(Right,X[q+1]+A[q+1])
        q+=1

print(q-p+1)
0