mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>Alice 和 Bob 是一场射箭比赛中的对手。比赛规则如下:</p>\n\n<ol>\n\t<li>Alice 先射 <code>numArrows</code> 支箭,然后 Bob 也射 <code>numArrows</code> 支箭。</li>\n\t<li>分数按下述规则计算:\n\t<ol>\n\t\t<li>箭靶有若干整数计分区域,范围从 <code>0</code> 到 <code>11</code> (含 <code>0</code> 和 <code>11</code>)。</li>\n\t\t<li>箭靶上每个区域都对应一个得分 <code>k</code>(范围是 <code>0</code> 到 <code>11</code>),Alice 和 Bob 分别在得分 <code>k</code> 区域射中 <code>a<sub>k</sub></code> 和 <code>b<sub>k</sub></code> 支箭。如果 <code>a<sub>k</sub> >= b<sub>k</sub></code> ,那么 Alice 得 <code>k</code> 分。如果 <code>a<sub>k</sub> < b<sub>k</sub></code> ,则 Bob 得 <code>k</code> 分</li>\n\t\t<li>如果 <code>a<sub>k</sub> == b<sub>k</sub> == 0</code> ,那么无人得到 <code>k</code> 分。</li>\n\t</ol>\n\t</li>\n</ol>\n\n<ul>\n\t<li>\n\t<p>例如,Alice 和 Bob 都向计分为 <code>11</code> 的区域射 <code>2</code> 支箭,那么 Alice 得 <code>11</code> 分。如果 Alice 向计分为 <code>11</code> 的区域射 <code>0</code> 支箭,但 Bob 向同一个区域射 <code>2</code> 支箭,那么 Bob 得 <code>11</code> 分。</p>\n\t</li>\n</ul>\n\n<p>给你整数 <code>numArrows</code> 和一个长度为 <code>12</code> 的整数数组 <code>aliceArrows</code> ,该数组表示 Alice 射中 <code>0</code> 到 <code>11</code> 每个计分区域的箭数量。现在,Bob 想要尽可能 <strong>最大化</strong> 他所能获得的总分。</p>\n\n<p>返回数组 <code>bobArrows</code><em> </em>,该数组表示 Bob 射中 <code>0</code> 到 <code>11</code> <strong>每个</strong> 计分区域的箭数量。且 <code>bobArrows</code> 的总和应当等于 <code>numArrows</code> 。</p>\n\n<p>如果存在多种方法都可以使 Bob 获得最大总分,返回其中 <strong>任意一种</strong> 即可。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1647744752-kQKrXw-image.png\" style=\"width: 600px; height: 120px;\" /></p>\n\n<pre>\n<strong>输入:</strong>numArrows = 9, aliceArrows = [1,1,0,1,0,0,2,1,0,1,2,0]\n<strong>输出:</strong>[0,0,0,0,1,1,0,0,1,2,3,1]\n<strong>解释:</strong>上表显示了比赛得分情况。\nBob 获得总分 4 + 5 + 8 + 9 + 10 + 11 = 47 。\n可以证明 Bob 无法获得比 47 更高的分数。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1647744785-cMHzaC-image.png\" style=\"width: 600px; height: 117px;\" /></p>\n\n<pre>\n<strong>输入:</strong>numArrows = 3, aliceArrows = [0,0,1,0,0,0,0,0,0,0,0,2]\n<strong>输出:</strong>[0,0,0,0,0,0,0,0,1,1,1,0]\n<strong>解释:</strong>上表显示了比赛得分情况。\nBob 获得总分 8 + 9 + 10 = 27 。\n可以证明 Bob 无法获得比 27 更高的分数。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= numArrows <= 10<sup>5</sup></code></li>\n\t<li><code>aliceArrows.length == bobArrows.length == 12</code></li>\n\t<li><code>0 <= aliceArrows[i], bobArrows[i] <= numArrows</code></li>\n\t<li><code>sum(aliceArrows[i]) == numArrows</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 25,
|
||||
"likes": 30,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.4K\", \"totalSubmission\": \"11.6K\", \"totalAcceptedRaw\": 5378, \"totalSubmissionRaw\": 11630, \"acRate\": \"46.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.8K\", \"totalSubmission\": \"12.6K\", \"totalAcceptedRaw\": 5839, \"totalSubmissionRaw\": 12565, \"acRate\": \"46.5%\"}",
|
||||
"hints": [
|
||||
"To obtain points for some certain section x, what is the minimum number of arrows Bob must shoot?",
|
||||
"Given the small number of sections, can we brute force which sections Bob wants to win?",
|
||||
|
Reference in New Issue
Block a user