結果

問題 No.871 かえるのうた
ユーザー NoneNone
提出日時 2021-03-12 14:04:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 96,324 KB
最終ジャッジ日時 2023-08-20 09:38:33
合計ジャッジ時間 7,579 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,292 KB
testcase_01 AC 74 ms
71,392 KB
testcase_02 AC 73 ms
71,192 KB
testcase_03 AC 75 ms
71,460 KB
testcase_04 AC 74 ms
71,324 KB
testcase_05 AC 74 ms
71,404 KB
testcase_06 AC 74 ms
71,344 KB
testcase_07 AC 72 ms
71,304 KB
testcase_08 AC 80 ms
75,620 KB
testcase_09 AC 76 ms
75,616 KB
testcase_10 AC 77 ms
75,504 KB
testcase_11 AC 76 ms
75,756 KB
testcase_12 AC 80 ms
77,744 KB
testcase_13 AC 77 ms
75,520 KB
testcase_14 AC 126 ms
93,760 KB
testcase_15 AC 121 ms
93,496 KB
testcase_16 AC 137 ms
95,812 KB
testcase_17 AC 120 ms
93,484 KB
testcase_18 AC 80 ms
78,448 KB
testcase_19 AC 129 ms
95,184 KB
testcase_20 AC 86 ms
76,656 KB
testcase_21 AC 111 ms
86,464 KB
testcase_22 AC 75 ms
71,128 KB
testcase_23 AC 74 ms
71,320 KB
testcase_24 AC 75 ms
71,372 KB
testcase_25 AC 81 ms
76,360 KB
testcase_26 AC 83 ms
76,468 KB
testcase_27 AC 80 ms
76,032 KB
testcase_28 AC 74 ms
71,288 KB
testcase_29 AC 99 ms
92,964 KB
testcase_30 AC 120 ms
96,324 KB
testcase_31 AC 78 ms
75,600 KB
testcase_32 AC 119 ms
95,168 KB
testcase_33 AC 121 ms
94,372 KB
testcase_34 AC 86 ms
80,040 KB
testcase_35 AC 101 ms
92,808 KB
testcase_36 AC 112 ms
94,608 KB
testcase_37 AC 111 ms
87,796 KB
testcase_38 AC 133 ms
93,696 KB
testcase_39 AC 129 ms
92,592 KB
testcase_40 AC 109 ms
93,756 KB
testcase_41 AC 79 ms
71,296 KB
testcase_42 AC 103 ms
93,396 KB
testcase_43 AC 76 ms
71,348 KB
testcase_44 AC 74 ms
71,352 KB
testcase_45 AC 83 ms
76,216 KB
testcase_46 AC 73 ms
71,296 KB
testcase_47 AC 74 ms
71,232 KB
testcase_48 AC 74 ms
70,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
X=list(map(int, input().split()))
A=list(map(int, input().split()))

l,r=K-1,K-1
L,R=X[l]-A[l],X[r]+A[r]
while (r+1<N and X[r+1]<=R) or (l>0 and X[l-1]>=L):
    if r+1<N and X[r+1]<=R:
        r+=1
        R=max(X[r]+A[r],R)
        L=min(X[r]-A[r],L)
    if l>0 and X[l-1]>=L:
        l-=1
        R=max(X[l]+A[l],R)
        L=min(X[l]-A[l],L)
print(r-l+1)
0