結果

問題 No.871 かえるのうた
ユーザー tails1434tails1434
提出日時 2020-01-05 19:40:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 98,432 KB
最終ジャッジ日時 2024-05-02 10:12:06
合計ジャッジ時間 5,626 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,840 KB
testcase_01 AC 34 ms
51,968 KB
testcase_02 AC 32 ms
52,096 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 34 ms
52,224 KB
testcase_06 WA -
testcase_07 AC 34 ms
52,480 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 37 ms
58,368 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 85 ms
92,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 90 ms
94,848 KB
testcase_18 AC 44 ms
67,712 KB
testcase_19 WA -
testcase_20 AC 47 ms
64,000 KB
testcase_21 WA -
testcase_22 AC 34 ms
52,224 KB
testcase_23 AC 33 ms
52,096 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 35 ms
52,096 KB
testcase_29 AC 64 ms
87,168 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 45 ms
70,272 KB
testcase_35 WA -
testcase_36 AC 86 ms
98,432 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 36 ms
51,968 KB
testcase_42 AC 61 ms
86,676 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 36 ms
51,584 KB
testcase_47 AC 34 ms
51,840 KB
testcase_48 AC 34 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, K = map(int, input().split())
    X = list(map(int, input().split()))
    A = list(map(int, input().split()))
    l = r = K - 1
    ld = X[K-1] - A[K-1]
    rd = X[K-1] + A[K-1]

    updated = True
    while updated:
        updated = False

        while l - 1 >= 0 and ld <= X[l - 1]:
            updated = 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]:
            updated = True
            r += 1
            ld = min(ld, X[r] - A[r])
            rd = max(rd, X[r] - A[r])

    print(r - l + 1)



if __name__ == "__main__":
    main()
0