結果

問題 No.871 かえるのうた
ユーザー anagohirameanagohirame
提出日時 2019-08-30 22:59:44
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 24,584 KB
最終ジャッジ日時 2023-08-20 09:21:56
合計ジャッジ時間 4,925 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,888 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 16 ms
7,928 KB
testcase_03 AC 16 ms
7,696 KB
testcase_04 AC 16 ms
7,692 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 16 ms
7,888 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 18 ms
8,444 KB
testcase_09 AC 19 ms
8,716 KB
testcase_10 AC 17 ms
8,296 KB
testcase_11 AC 16 ms
8,288 KB
testcase_12 AC 28 ms
11,260 KB
testcase_13 AC 19 ms
8,716 KB
testcase_14 AC 85 ms
24,064 KB
testcase_15 AC 83 ms
23,908 KB
testcase_16 AC 212 ms
24,584 KB
testcase_17 AC 80 ms
22,648 KB
testcase_18 AC 27 ms
11,404 KB
testcase_19 AC 92 ms
24,276 KB
testcase_20 AC 32 ms
9,608 KB
testcase_21 AC 60 ms
14,276 KB
testcase_22 AC 16 ms
7,924 KB
testcase_23 AC 16 ms
7,772 KB
testcase_24 AC 16 ms
7,768 KB
testcase_25 AC 21 ms
8,616 KB
testcase_26 AC 35 ms
9,588 KB
testcase_27 AC 26 ms
10,628 KB
testcase_28 AC 16 ms
7,696 KB
testcase_29 AC 48 ms
15,188 KB
testcase_30 AC 161 ms
20,192 KB
testcase_31 AC 17 ms
8,456 KB
testcase_32 AC 124 ms
18,368 KB
testcase_33 AC 88 ms
24,032 KB
testcase_34 AC 34 ms
12,748 KB
testcase_35 AC 53 ms
18,148 KB
testcase_36 AC 67 ms
20,968 KB
testcase_37 AC 97 ms
15,944 KB
testcase_38 AC 202 ms
23,972 KB
testcase_39 AC 170 ms
23,228 KB
testcase_40 AC 129 ms
16,236 KB
testcase_41 AC 17 ms
7,768 KB
testcase_42 AC 136 ms
16,140 KB
testcase_43 AC 16 ms
7,832 KB
testcase_44 AC 15 ms
7,736 KB
testcase_45 AC 19 ms
8,308 KB
testcase_46 AC 16 ms
7,816 KB
testcase_47 AC 16 ms
7,824 KB
testcase_48 AC 16 ms
7,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
x = list(map(int, input().split()))
a = list(map(int, input().split()))
left = list(range(k-1))
right = list(range(n-1, k-1, -1))
lm, rm = x[k-1]-a[k-1], x[k-1]+a[k-1]

while True:
	left_ok, right_ok = False, False
	if left != [] and x[left[-1]] >= lm:
		left_ok = True
		lm = min(lm, x[left[-1]]-a[left[-1]])
		rm = max(rm, x[left[-1]]+a[left[-1]])
		left.pop()
	if right != [] and x[right[-1]] <= rm:
		right_ok = True
		lm = min(lm, x[right[-1]]-a[right[-1]])
		rm = max(rm, x[right[-1]]+a[right[-1]])
		right.pop()
	if not left_ok and not right_ok:
		break

print(n-len(left)-len(right))
0