1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-12-19 10:34:57 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个&nbsp;<code>m x n</code>&nbsp;的二进制矩阵&nbsp;<code>grid</code>&nbsp;,每个格子要么为&nbsp;<code>0</code>&nbsp;(空)要么为&nbsp;<code>1</code>&nbsp;(被占据)。</p>\n\n<p>给你邮票的尺寸为&nbsp;<code>stampHeight x stampWidth</code>&nbsp;。我们想将邮票贴进二进制矩阵中,且满足以下&nbsp;<strong>限制</strong>&nbsp;和&nbsp;<strong>要求</strong>&nbsp;</p>\n\n<ol>\n\t<li>覆盖所有 <strong>空</strong>&nbsp;格子。</li>\n\t<li>不覆盖任何 <strong>被占据&nbsp;</strong>的格子。</li>\n\t<li>我们可以放入任意数目的邮票。</li>\n\t<li>邮票可以相互有 <strong>重叠</strong>&nbsp;部分。</li>\n\t<li>邮票不允许 <strong>旋转</strong>&nbsp;。</li>\n\t<li>邮票必须完全在矩阵 <strong>内</strong>&nbsp;。</li>\n</ol>\n\n<p>如果在满足上述要求的前提下,可以放入邮票,请返回&nbsp;<code>true</code>&nbsp;,否则返回<i>&nbsp;</i><code>false</code>&nbsp;。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/11/03/ex1.png\" style=\"width: 180px; height: 237px;\"></p>\n\n<pre><b>输入:</b>grid = [[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]], stampHeight = 4, stampWidth = 3\n<b>输出:</b>true\n<b>解释:</b>我们放入两个有重叠部分的邮票(图中标号为 1 和 2它们能覆盖所有与空格子。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/11/03/ex2.png\" style=\"width: 170px; height: 179px;\"></p>\n\n<pre><b>输入:</b>grid = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]], stampHeight = 2, stampWidth = 2 \n<b>输出:</b>false \n<b>解释:</b>没办法放入邮票覆盖所有的空格子,且邮票不超出网格图以外。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == grid.length</code></li>\n\t<li><code>n == grid[r].length</code></li>\n\t<li><code>1 &lt;= m, n &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= m * n &lt;= 2 * 10<sup>5</sup></code></li>\n\t<li><code>grid[r][c]</code> 要么是&nbsp;<code>0</code>&nbsp;,要么是&nbsp;<code>1</code> 。</li>\n\t<li><code>1 &lt;= stampHeight, stampWidth &lt;= 10<sup>5</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 29,
"likes": 32,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.7K\", \"totalSubmission\": \"7K\", \"totalAcceptedRaw\": 1744, \"totalSubmissionRaw\": 6971, \"acRate\": \"25.0%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"7.2K\", \"totalAcceptedRaw\": 1822, \"totalSubmissionRaw\": 7208, \"acRate\": \"25.3%\"}",
"hints": [
"We can check if every empty cell is a part of a consecutive row of empty cells that has a width of at least stampWidth as well as a consecutive column of empty cells that has a height of at least stampHeight.",
"We can prove that this condition is sufficient and necessary to fit the stamps while following the given restrictions and requirements.",