結果

問題 No.1512 作文
ユーザー 👑 tatt61880tatt61880
提出日時 2021-05-22 09:24:19
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 2,548 ms
コンパイル使用メモリ 160,700 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-10-14 18:27:48
合計ジャッジ時間 4,193 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 32 ms
4,352 KB
testcase_05 AC 36 ms
4,352 KB
testcase_06 AC 34 ms
4,348 KB
testcase_07 AC 34 ms
4,348 KB
testcase_08 AC 33 ms
4,352 KB
testcase_09 AC 12 ms
4,348 KB
testcase_10 AC 14 ms
4,348 KB
testcase_11 AC 12 ms
4,348 KB
testcase_12 AC 14 ms
4,348 KB
testcase_13 AC 13 ms
4,348 KB
testcase_14 AC 12 ms
4,348 KB
testcase_15 AC 12 ms
4,348 KB
testcase_16 AC 12 ms
4,348 KB
testcase_17 AC 12 ms
4,348 KB
testcase_18 AC 12 ms
4,348 KB
testcase_19 AC 12 ms
4,348 KB
testcase_20 AC 12 ms
4,352 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 3 ms
4,352 KB
testcase_24 AC 3 ms
4,352 KB
testcase_25 AC 3 ms
4,352 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,352 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 11 ms
4,456 KB
testcase_36 AC 11 ms
4,512 KB
testcase_37 AC 7 ms
4,348 KB
testcase_38 AC 7 ms
4,352 KB
testcase_39 AC 8 ms
4,348 KB
testcase_40 AC 43 ms
4,348 KB
testcase_41 AC 44 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var map: [][]int :: #[26, 26]int
	for loop(1, n)
		var s: []char :: cui@input()
		var t: []char :: ##s
		do t.sort()
		if(s <> t)
			skip loop
		end if
		var cs: int :: s[0] $ int - 'a' $ int
		var ce: int :: s[^s - 1] $ int - 'a' $ int
		if(cs = ce)
			do map[cs][ce] :+ ^s
		else
			do map[cs][ce] :: [map[cs][ce], ^s].max()
		end if
	end for
	
	var dp: []int :: #[26]int
	for cs(0, 25)
		for ce(cs, 25)
			do dp[ce] :: [dp[ce], dp[cs] + map[cs][ce]].max()
		end for
	end for
	
	var ans: int :: dp[25]
	do cui@print("\{ans}\n")
end func
0