枚举所有的颜色集合,DP 从起点到终点,只经过集合中的颜色的最短路径,然后更新答案。
时间复杂度 $O(n^2 2^k)$。
As we are currently experiencing an overwhelming number of web requests for fetching user submissions, we have temporarily disabled the full submissions list. You must now be logged in to view submissions.
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-12 23:31:26
Last updated: 2025-12-12 23:31:31
枚举所有的颜色集合,DP 从起点到终点,只经过集合中的颜色的最短路径,然后更新答案。
时间复杂度 $O(n^2 2^k)$。