Skip to content

feat: update lc problems #4609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README.md
rating: 1459
source: 第 452 场周赛 Q1
tags:
- 位运算
- 递归
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README_EN.md
rating: 1459
source: Weekly Contest 452 Q1
tags:
- Bit Manipulation
- Recursion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README.md
rating: 1568
source: 第 452 场周赛 Q2
tags:
- 数组
- 矩阵
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README_EN.md
rating: 1568
source: Weekly Contest 452 Q2
tags:
- Array
- Matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README.md
rating: 2143
source: 第 452 场周赛 Q3
tags:
- 位运算
- 广度优先搜索
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README_EN.md
rating: 2143
source: Weekly Contest 452 Q3
tags:
- Bit Manipulation
- Breadth-First Search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README.md
rating: 2697
source: 第 452 场周赛 Q4
tags:
- 线段树
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README_EN.md
rating: 2697
source: Weekly Contest 452 Q4
tags:
- Segment Tree
- Array
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
---
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README.md
tags:
- 数组
- 排序
---

<!-- problem:start -->

# [3631. 按严重性和可利用性排序威胁 🔒](https://leetcode.cn/problems/sort-threats-by-severity-and-exploitability)

[English Version](/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README_EN.md)

## 题目描述

<!-- description:start -->

<p>给定一个二维整数数组&nbsp;<code>threats</code>,其中&nbsp;<code>threats[i] = [ID<sub>i</sub>, sev<sub>i</sub>​, exp<sub>i</sub>]</code>。</p>

<ul>
<li><code>ID<sub>i</sub></code>:威胁的唯一标识。</li>
<li><code>sev<sub>i</sub></code>:表示威胁的严重程度。</li>
<li><code>exp<sub>i</sub></code>:表示威胁的可利用性。</li>
</ul>

<p>威胁 <code>i</code>&nbsp;的 <strong>分数</strong>&nbsp;定义为:<code>score = 2 × sev<sub>i</sub> + exp<sub>i</sub></code></p>

<p>你的任务是按 <strong>分数降序</strong>&nbsp;返回&nbsp;<code>threats</code>。</p>

<p>如果多个威胁具有相同的分数,则按 ID <strong>升序&nbsp;</strong>排序。</p>

<p>&nbsp;</p>

<p><strong class="example">示例 1:</strong></p>

<div class="example-block">
<p><span class="example-io"><b>输入:</b>threats = [[101,2,3],[102,3,2],[103,3,3]]</span></p>

<p><span class="example-io"><b>输出:</b>[[103,3,3],[102,3,2],[101,2,3]]</span></p>

<p><strong>解释:</strong></p>

<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
<thead>
<tr>
<th>威胁</th>
<th>ID</th>
<th>sev</th>
<th>exp</th>
<th>分数 = 2 × sev + exp</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>threats[0]</code></td>
<td>101</td>
<td>2</td>
<td>3</td>
<td>2 × 2 + 3 = 7</td>
</tr>
<tr>
<td><code>threats[1]</code></td>
<td>102</td>
<td>3</td>
<td>2</td>
<td>2 × 3 + 2 = 8</td>
</tr>
<tr>
<td><code>threats[2]</code></td>
<td>103</td>
<td>3</td>
<td>3</td>
<td>2 × 3 + 3 = 9</td>
</tr>
</tbody>
</table>

<p>排序顺序:<code>[[103, 3, 3], [102, 3, 2], [101, 2, 3]]</code></p>
</div>

<p><strong class="example">示例 2:</strong></p>

<div class="example-block">
<p><span class="example-io"><b>输入:</b>threats = [[101,4,1],[103,1,5],[102,1,5]]</span></p>

<p><span class="example-io"><b>输出:</b>[[101,4,1],[102,1,5],[103,1,5]]</span></p>

<p><strong>解释:</strong></p>

<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
<thead>
<tr>
<th>威胁</th>
<th>ID</th>
<th>sev</th>
<th>exp</th>
<th>分数 = 2 × sev + exp</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>threats[0]</code></td>
<td>101</td>
<td>4</td>
<td>1</td>
<td>2 × 4 + 1 = 9</td>
</tr>
<tr>
<td><code>threats[1]</code></td>
<td>103</td>
<td>1</td>
<td>5</td>
<td>2 × 1 + 5 = 7</td>
</tr>
<tr>
<td><code>threats[2]</code></td>
<td>102</td>
<td>1</td>
<td>5</td>
<td>2 × 1 + 5 = 7</td>
</tr>
</tbody>
</table>

<p><code>threats[1]</code> 与&nbsp;<code>threats[2]</code>&nbsp;有相同的分数,因此它们按升序排序。</p>

<p>排序顺序:<code>[[101, 4, 1], [102, 1, 5], [103, 1, 5]]</code></p>
</div>

<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li><code>1 &lt;= threats.length &lt;= 10<sup>5</sup></code></li>
<li><code>threats[i] == [ID<sub>i</sub>, sev<sub>i</sub>, exp<sub>i</sub>]</code></li>
<li><code>1 &lt;= ID<sub>i</sub> &lt;= 10<sup>6</sup></code></li>
<li><code>1 &lt;= sev<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= exp<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
<li>所有&nbsp;<code>ID<sub>i</sub></code> <strong>互不相同</strong>。</li>
</ul>

<!-- description:end -->

## 解法

<!-- solution:start -->

### 方法一

<!-- tabs:start -->

#### Python3

```python

```

#### Java

```java

```

#### C++

```cpp

```

#### Go

```go

```

<!-- tabs:end -->

<!-- solution:end -->

<!-- problem:end -->
Loading