結果

問題 No.871 かえるのうた
ユーザー terasaterasa
提出日時 2022-06-05 21:07:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,126 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 92,764 KB
最終ジャッジ日時 2023-10-21 03:17:47
合計ジャッジ時間 6,505 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,548 KB
testcase_01 WA -
testcase_02 AC 45 ms
55,548 KB
testcase_03 AC 45 ms
55,548 KB
testcase_04 AC 44 ms
55,548 KB
testcase_05 AC 45 ms
55,548 KB
testcase_06 WA -
testcase_07 AC 45 ms
55,548 KB
testcase_08 AC 47 ms
61,444 KB
testcase_09 AC 49 ms
61,444 KB
testcase_10 AC 48 ms
61,444 KB
testcase_11 AC 48 ms
61,444 KB
testcase_12 AC 53 ms
69,608 KB
testcase_13 AC 48 ms
63,492 KB
testcase_14 AC 94 ms
91,444 KB
testcase_15 AC 93 ms
91,468 KB
testcase_16 AC 102 ms
92,764 KB
testcase_17 AC 92 ms
91,272 KB
testcase_18 AC 54 ms
69,936 KB
testcase_19 WA -
testcase_20 AC 55 ms
66,360 KB
testcase_21 AC 77 ms
84,444 KB
testcase_22 AC 44 ms
55,548 KB
testcase_23 AC 45 ms
55,548 KB
testcase_24 AC 44 ms
55,548 KB
testcase_25 AC 52 ms
64,016 KB
testcase_26 AC 53 ms
66,064 KB
testcase_27 AC 51 ms
68,140 KB
testcase_28 AC 44 ms
55,548 KB
testcase_29 AC 71 ms
88,508 KB
testcase_30 AC 88 ms
92,500 KB
testcase_31 AC 48 ms
61,464 KB
testcase_32 AC 88 ms
92,132 KB
testcase_33 WA -
testcase_34 AC 58 ms
73,664 KB
testcase_35 AC 75 ms
88,972 KB
testcase_36 AC 82 ms
89,464 KB
testcase_37 AC 79 ms
85,952 KB
testcase_38 AC 96 ms
91,816 KB
testcase_39 WA -
testcase_40 AC 74 ms
89,140 KB
testcase_41 AC 45 ms
55,548 KB
testcase_42 AC 73 ms
88,744 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 45 ms
55,548 KB
testcase_47 AC 44 ms
55,548 KB
testcase_48 AC 45 ms
55,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


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

l = X[K]
r = X[K]
li = K
ri = K
for i in range(K, -1, -1):
    if X[i] < l:
        break
    l = min(l, X[i] - A[i])
    li -= 1
for i in range(K, N):
    if r < X[i]:
        break
    r = max(r, X[i] + A[i])
    ri += 1
# li < x < ri
print(ri - li - 1)
0