結果

問題 No.92 逃走経路
コンテスト
ユーザー tatt61880
提出日時 2021-04-03 23:25:08
言語 Kuin
(KuinC++ v.2021.9.17)
コンパイル:
kuinc -i _filename_ -o out.cpp -s /kuin/sys/ -e cpp -r -q
実行:
./a.out
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 949 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,643 ms
コンパイル使用メモリ 170,284 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-05 17:28:46
合計ジャッジ時間 3,168 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Dict_<long, bool>>' [-Wnontrivial-memcall]
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
out.cpp:680:15: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<Dict_<long, bool>>>>>::operator()<long>' requested here
  680 |                                 r->B[i] = newArraysRec_<T>()(std::forward<C>(t)...);
      |                                           ^
out.cpp:688:9: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<Array_<std::shared_ptr<Dict_<long, bool>>>>>>>::operator()<long, long>' requested here
  688 |         return newArraysRec_<T>()(std::forward<A>(a)...);
      |                ^
out.cpp:1638:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<std::shared_ptr<Dict_<long, bool>>>>>>, long, long>' requested here
 1638 | (k_aq) = (newArrays_<type_(Array_<type_(Array_<type_(Dict_<int64_t, bool>)>)>)>((k_am), (k_am)));
      |           ^
out.cpp:676:14: note: explicitly cast the pointer to silence this warning
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
      |                                (void*)
1 warning generated.

ソースコード

diff #
raw source code

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