結果

問題 No.871 かえるのうた
ユーザー anagohirameanagohirame
提出日時 2019-08-30 22:59:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,748 KB
最終ジャッジ日時 2024-05-07 16:26:08
合計ジャッジ時間 4,911 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 28 ms
10,880 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,624 KB
testcase_08 AC 30 ms
11,264 KB
testcase_09 AC 31 ms
11,264 KB
testcase_10 AC 29 ms
11,008 KB
testcase_11 AC 28 ms
11,008 KB
testcase_12 AC 41 ms
13,532 KB
testcase_13 AC 30 ms
11,392 KB
testcase_14 AC 105 ms
27,864 KB
testcase_15 AC 104 ms
28,084 KB
testcase_16 AC 254 ms
28,748 KB
testcase_17 AC 96 ms
26,448 KB
testcase_18 AC 39 ms
13,324 KB
testcase_19 AC 109 ms
28,240 KB
testcase_20 AC 44 ms
12,080 KB
testcase_21 AC 77 ms
16,932 KB
testcase_22 AC 27 ms
10,624 KB
testcase_23 AC 28 ms
10,752 KB
testcase_24 AC 27 ms
10,752 KB
testcase_25 AC 32 ms
11,136 KB
testcase_26 AC 50 ms
12,032 KB
testcase_27 AC 39 ms
12,800 KB
testcase_28 AC 28 ms
10,752 KB
testcase_29 AC 64 ms
17,860 KB
testcase_30 AC 193 ms
22,772 KB
testcase_31 AC 30 ms
11,136 KB
testcase_32 AC 145 ms
20,140 KB
testcase_33 AC 100 ms
25,804 KB
testcase_34 AC 47 ms
14,868 KB
testcase_35 AC 69 ms
19,328 KB
testcase_36 AC 84 ms
22,480 KB
testcase_37 AC 121 ms
17,580 KB
testcase_38 AC 235 ms
25,676 KB
testcase_39 AC 201 ms
25,908 KB
testcase_40 AC 161 ms
17,860 KB
testcase_41 AC 27 ms
10,752 KB
testcase_42 AC 167 ms
17,860 KB
testcase_43 AC 28 ms
10,880 KB
testcase_44 AC 28 ms
10,624 KB
testcase_45 AC 31 ms
11,008 KB
testcase_46 AC 28 ms
10,880 KB
testcase_47 AC 28 ms
10,624 KB
testcase_48 AC 27 ms
10,624 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