mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两组点,其中第一组中有 <code>size<sub>1</sub></code> 个点,第二组中有 <code>size<sub>2</sub></code> 个点,且 <code>size<sub>1</sub> >= size<sub>2</sub></code> 。</p>\n\n<p>任意两点间的连接成本 <code>cost</code> 由大小为 <code>size<sub>1</sub> x size<sub>2</sub></code> 矩阵给出,其中 <code>cost[i][j]</code> 是第一组中的点 <code>i</code> 和第二组中的点 <code>j</code> 的连接成本。<strong>如果两个组中的每个点都与另一组中的一个或多个点连接,则称这两组点是连通的。</strong>换言之,第一组中的每个点必须至少与第二组中的一个点连接,且第二组中的每个点必须至少与第一组中的一个点连接。</p>\n\n<p>返回连通两组点所需的最小成本。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/09/20/ex1.jpg\" style=\"height: 243px; width: 322px;\"></p>\n\n<pre><strong>输入:</strong>cost = [[15, 96], [36, 2]]\n<strong>输出:</strong>17\n<strong>解释:</strong>连通两组点的最佳方法是:\n1--A\n2--B\n总成本为 17 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/09/20/ex2.jpg\" style=\"height: 403px; width: 322px;\"></p>\n\n<pre><strong>输入:</strong>cost = [[1, 3, 5], [4, 1, 1], [1, 5, 3]]\n<strong>输出:</strong>4\n<strong>解释:</strong>连通两组点的最佳方法是:\n1--A\n2--B\n2--C\n3--A\n最小成本为 4 。\n请注意,虽然有多个点连接到第一组中的点 2 和第二组中的点 A ,但由于题目并不限制连接点的数目,所以只需要关心最低总成本。</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>cost = [[2, 5, 1], [3, 4, 7], [8, 1, 2], [6, 2, 4], [3, 8, 8]]\n<strong>输出:</strong>10\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>size<sub>1</sub> == cost.length</code></li>\n\t<li><code>size<sub>2</sub> == cost[i].length</code></li>\n\t<li><code>1 <= size<sub>1</sub>, size<sub>2</sub> <= 12</code></li>\n\t<li><code>size<sub>1</sub> >= size<sub>2</sub></code></li>\n\t<li><code>0 <= cost[i][j] <= 100</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 52,
|
||||
"likes": 54,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.2K\", \"totalSubmission\": \"4.6K\", \"totalAcceptedRaw\": 2224, \"totalSubmissionRaw\": 4577, \"acRate\": \"48.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.3K\", \"totalSubmission\": \"4.6K\", \"totalAcceptedRaw\": 2265, \"totalSubmissionRaw\": 4648, \"acRate\": \"48.7%\"}",
|
||||
"hints": [
|
||||
"Each point on the left would either be connected to exactly point already connected to some left node, or a subset of the nodes on the right which are not connected to any node",
|
||||
"Use dynamic programming with bitmasking, where the state will be (number of points assigned in first group, bitmask of points assigned in second group)."
|
||||
|
Reference in New Issue
Block a user