結果

問題 No.92 逃走経路
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-03 23:25:08
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 949 bytes
コンパイル時間 2,394 ms
コンパイル使用メモリ 167,276 KB
実行使用メモリ 4,808 KB
最終ジャッジ日時 2023-10-14 18:15:43
合計ジャッジ時間 4,038 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
4,808 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 3 ms
4,352 KB
testcase_06 AC 4 ms
4,352 KB
testcase_07 AC 3 ms
4,352 KB
testcase_08 AC 5 ms
4,688 KB
testcase_09 AC 73 ms
4,764 KB
testcase_10 AC 19 ms
4,348 KB
testcase_11 AC 27 ms
4,372 KB
testcase_12 AC 71 ms
4,576 KB
testcase_13 AC 33 ms
4,532 KB
testcase_14 AC 37 ms
4,600 KB
testcase_15 AC 49 ms
4,524 KB
testcase_16 AC 40 ms
4,740 KB
testcase_17 AC 45 ms
4,788 KB
testcase_18 AC 24 ms
4,352 KB
testcase_19 AC 11 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var m: int :: cui@inputInt()
	var k: int :: cui@inputInt()
	var map: [][]dict<int, bool> :: #[n, n]dict<int, bool>
	for a(0, n - 1)
		for b(0, n - 1)
			do map[a][b] :: #dict<int, bool>
		end for
	end for
	for(1, m)
		var a: int :: cui@inputInt() - 1
		var b: int :: cui@inputInt() - 1
		var c: int :: cui@inputInt()
		do map[a][b].add(c, true)
		do map[b][a].add(c, true)
	end for
	
	var exists: [][]bool :: #[k + 1, n]bool
	do exists[0] :: [true].repeat(n)
	for i(0, k - 1)
		var d: int :: cui@inputInt()
		for a(0, n - 1)
			if(exists[i][a])
				for b(0, n - 1)
					if(map[a][b].get(d, &))
						do exists[i + 1][b] :: true
					end if
				end for
			end if
		end for
	end for
	var ans: []int :: #[0]int
	for i(0, n - 1)
		if(exists[k][i])
			do ans :~ [i + 1]
		end if
	end for
	do cui@print("\{^ans}\n")
	for i(0, ^ans - 1)
		do cui@print("\{ans[i]}" ~ (i = ^ans - 1 ?("\n", " ")))
	end for
end func
0