結果

問題 No.1188 レベルX門松列
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-23 00:45:34
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 1,165 bytes
コンパイル時間 2,534 ms
コンパイル使用メモリ 154,320 KB
実行使用メモリ 8,208 KB
最終ジャッジ日時 2023-10-14 17:22:37
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
8,072 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 96 ms
8,132 KB
testcase_07 AC 111 ms
8,140 KB
testcase_08 AC 110 ms
8,204 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 3 ms
4,352 KB
testcase_23 AC 2 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var a: []int :: #[n]int
	for i(0, n - 1)
		do a[i] :: cui@inputInt()
	end for
	var lis: []int :: getLisArr(a)
	do a.reverse()
	var revLis: []int :: getLisArr(a)
	do revLis.reverse()
	do a.reverse()
	for i(0, n - 1)
		do a[i] :: -1 * a[i]
	end for
	var lds: []int :: getLisArr(a)
	do a.reverse()
	var revLds: []int :: getLisArr(a)
	do revLis.reverse()
	do a.reverse()
	
	var ans: int :: -1
	for i(0, n - 1)
		do ans :: [ans, lib@min(lis[i], revLis[i]) - 1, lib@min(lds[i], revLds[i]) - 1].max()
	end for
	do cui@print("\{ans}\n")
	
	func getLisArr(a: []int): []int
		const infInt: int :: lib@intMax
		var n: int :: ^a
		var buff: []int :: [infInt].repeat(n + 1)
		var lisArr: []int :: #[n]int
		for i(0, n - 1)
			var idx: int :: f(buff, a[i])
			do buff[idx] :: a[i]
			do lisArr[i] :: f(buff, infInt)
			func f(arr: []int, val: int): int
				var ok: int :: -1
				var ng: int :: ^arr - 1
				while((ok - ng).abs() > 1)
					var mid: int :: (ok + ng) / 2
					if(val > arr[mid])
						do ok :: mid
					else
						do ng :: mid
					end if
				end while
				ret ok + 1
			end func
		end for
		ret lisArr
	end func
end func
0