結果

問題 No.871 かえるのうた
ユーザー 👑 tatt61880tatt61880
提出日時 2020-06-02 19:20:51
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 6,373 ms
コンパイル使用メモリ 146,448 KB
実行使用メモリ 5,504 KB
最終ジャッジ日時 2024-05-07 16:39:14
合計ジャッジ時間 9,599 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 19 ms
5,376 KB
testcase_13 AC 6 ms
5,376 KB
testcase_14 AC 122 ms
5,376 KB
testcase_15 AC 121 ms
5,504 KB
testcase_16 AC 137 ms
5,376 KB
testcase_17 AC 116 ms
5,376 KB
testcase_18 AC 20 ms
5,376 KB
testcase_19 AC 123 ms
5,504 KB
testcase_20 AC 12 ms
5,376 KB
testcase_21 AC 47 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 10 ms
5,376 KB
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 51 ms
5,376 KB
testcase_30 AC 83 ms
5,376 KB
testcase_31 AC 5 ms
5,376 KB
testcase_32 AC 71 ms
5,376 KB
testcase_33 AC 104 ms
5,376 KB
testcase_34 AC 27 ms
5,376 KB
testcase_35 AC 62 ms
5,376 KB
testcase_36 AC 85 ms
5,376 KB
testcase_37 AC 54 ms
5,376 KB
testcase_38 AC 116 ms
5,376 KB
testcase_39 AC 110 ms
5,376 KB
testcase_40 AC 51 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 52 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 3 ms
5,376 KB
testcase_46 AC 2 ms
5,376 KB
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var k: int :: cui@inputInt()
	var x: []int :: #[n]int
	var a: []int :: #[n]int
	for i(0, n - 1)
		do x[i] :: cui@inputInt()
	end for
	for i(0, n - 1)
		do a[i] :: cui@inputInt()
	end for
	
	var l: int :: k - 2
	var r: int :: k
	var xl: int :: x[k - 1] - a[k - 1]
	var xr: int :: x[k - 1] + a[k - 1]
	
	while loop(true)
		if(l >= 0 & x[l] >= xl)
			do xl :: [xl, x[l] - a[l]].min()
			do xr :: [xr, x[l] + a[l]].max()
			do l :- 1
			do ans :+ 1
			skip loop
		end if
		if(r < n & x[r] <= xr)
			do xl :: [xl, x[r] - a[r]].min()
			do xr :: [xr, x[r] + a[r]].max()
			do r :+ 1
			do ans :+ 1
			skip loop
		end if
		break loop
	end while
	
	var ans: int :: r - l - 1
	do cui@print("\{ans}\n")
end func
0