1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/无矛盾的最佳球队 [best-team-with-no-conflicts].html
2022-03-29 12:43:11 +08:00

39 lines
1.7 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>假设你是球队的经理。对于即将到来的锦标赛,你想组合一支总体得分最高的球队。球队的得分是球队中所有球员的分数 <strong>总和</strong></p>
<p>然而,球队中的矛盾会限制球员的发挥,所以必须选出一支 <strong>没有矛盾</strong> 的球队。如果一名年龄较小球员的分数 <strong>严格大于</strong> 一名年龄较大的球员,则存在矛盾。同龄球员之间不会发生矛盾。</p>
<p>给你两个列表 <code>scores</code><code>ages</code>,其中每组 <code>scores[i]</code><code>ages[i]</code> 表示第 <code>i</code> 名球员的分数和年龄。请你返回 <strong>所有可能的无矛盾球队中得分最高那支的分数</strong></p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>scores = [1,3,5,10,15], ages = [1,2,3,4,5]
<strong>输出:</strong>34
<strong>解释:</strong>你可以选中所有球员。</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>scores = [4,5,6,5], ages = [2,1,2,1]
<strong>输出:</strong>16
<strong>解释:</strong>最佳的选择是后 3 名球员。注意,你可以选中多个同龄球员。
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>scores = [1,2,3,5], ages = [8,9,10,1]
<strong>输出:</strong>6
<strong>解释:</strong>最佳的选择是前 3 名球员。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= scores.length, ages.length &lt;= 1000</code></li>
<li><code>scores.length == ages.length</code></li>
<li><code>1 &lt;= scores[i] &lt;= 10<sup>6</sup></code></li>
<li><code>1 &lt;= ages[i] &lt;= 1000</code></li>
</ul>