結果

問題 No.871 かえるのうた
ユーザー 👑 tatt61880tatt61880
提出日時 2020-06-02 19:20:51
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 3,550 ms
コンパイル使用メモリ 150,756 KB
実行使用メモリ 5,060 KB
最終ジャッジ日時 2023-08-20 09:34:54
合計ジャッジ時間 6,592 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,500 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 19 ms
4,380 KB
testcase_13 AC 7 ms
4,500 KB
testcase_14 AC 125 ms
4,984 KB
testcase_15 AC 124 ms
5,060 KB
testcase_16 AC 139 ms
5,036 KB
testcase_17 AC 114 ms
5,040 KB
testcase_18 AC 22 ms
4,380 KB
testcase_19 AC 130 ms
5,044 KB
testcase_20 AC 12 ms
4,376 KB
testcase_21 AC 49 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 4 ms
4,380 KB
testcase_26 AC 10 ms
4,376 KB
testcase_27 AC 14 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 51 ms
4,492 KB
testcase_30 AC 85 ms
4,700 KB
testcase_31 AC 4 ms
4,376 KB
testcase_32 AC 71 ms
4,532 KB
testcase_33 AC 105 ms
4,900 KB
testcase_34 AC 27 ms
4,376 KB
testcase_35 AC 64 ms
4,580 KB
testcase_36 AC 88 ms
4,892 KB
testcase_37 AC 55 ms
4,384 KB
testcase_38 AC 120 ms
4,972 KB
testcase_39 AC 113 ms
5,012 KB
testcase_40 AC 53 ms
4,432 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 53 ms
4,524 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 3 ms
4,380 KB
testcase_45 AC 4 ms
4,380 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 2 ms
4,380 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