mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 21:46:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>Alice 和 Bob 轮流玩一个游戏,Alice 先手。</p>\n\n<p>一堆石子里总共有 <code>n</code> 个石子,轮到某个玩家时,他可以 <strong>移出</strong> 一个石子并得到这个石子的价值。Alice 和 Bob 对石子价值有 <strong>不一样的的评判标准</strong> 。双方都知道对方的评判标准。</p>\n\n<p>给你两个长度为 <code>n</code> 的整数数组 <code>aliceValues</code> 和 <code>bobValues</code> 。<code>aliceValues[i]</code> 和 <code>bobValues[i]</code> 分别表示 Alice 和 Bob 认为第 <code>i</code> 个石子的价值。</p>\n\n<p>所有石子都被取完后,得分较高的人为胜者。如果两个玩家得分相同,那么为平局。两位玩家都会采用 <b>最优策略</b> 进行游戏。</p>\n\n<p>请你推断游戏的结果,用如下的方式表示:</p>\n\n<ul>\n\t<li>如果 Alice 赢,返回 <code>1</code> 。</li>\n\t<li>如果 Bob 赢,返回 <code>-1</code> 。</li>\n\t<li>如果游戏平局,返回 <code>0</code> 。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>aliceValues = [1,3], bobValues = [2,1]\n<b>输出:</b>1\n<strong>解释:</strong>\n如果 Alice 拿石子 1 (下标从 0开始),那么 Alice 可以得到 3 分。\nBob 只能选择石子 0 ,得到 2 分。\nAlice 获胜。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>aliceValues = [1,2], bobValues = [3,1]\n<b>输出:</b>0\n<strong>解释:</strong>\nAlice 拿石子 0 , Bob 拿石子 1 ,他们得分都为 1 分。\n打平。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<b>输入:</b>aliceValues = [2,4,3], bobValues = [1,6,7]\n<b>输出:</b>-1\n<strong>解释:</strong>\n不管 Alice 怎么操作,Bob 都可以得到比 Alice 更高的得分。\n比方说,Alice 拿石子 1 ,Bob 拿石子 2 , Alice 拿石子 0 ,Alice 会得到 6 分而 Bob 得分为 7 分。\nBob 会获胜。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == aliceValues.length == bobValues.length</code></li>\n\t<li><code>1 <= n <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= aliceValues[i], bobValues[i] <= 100</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 40,
|
||||
"likes": 42,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -167,7 +167,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.3K\", \"totalSubmission\": \"6.8K\", \"totalAcceptedRaw\": 3260, \"totalSubmissionRaw\": 6776, \"acRate\": \"48.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.4K\", \"totalSubmission\": \"7K\", \"totalAcceptedRaw\": 3368, \"totalSubmissionRaw\": 6971, \"acRate\": \"48.3%\"}",
|
||||
"hints": [
|
||||
"When one takes the stone, they not only get the points, but they take them away from the other player too.",
|
||||
"Greedily choose the stone with the maximum aliceValues[i] + bobValues[i]."
|
||||
|
Reference in New Issue
Block a user