QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 2048 MB Puntuación total: 100

#10257. 垃圾回收

Estadísticas

北海散落着 $N$ 件垃圾,编号为 $1 \dots N$。第 $i$ 件垃圾位于位置 $(x_i, y_i)$,重量为 $w_i$。作为清理工作的一部分,所有位于一个矩形区域内的垃圾都将被收集。该区域的宽度为 $W$,高度为 $H$,但其具体位置尚未确定。

请确定如果以最优方式放置清理区域,所能收集到的垃圾总重量的最大值。

输入格式

第一行包含整数 $N$、$W$ 和 $H$。 接下来 $N$ 行,第 $i$ 行包含整数 $x_i$、$y_i$ 和 $w_i$。

输出格式

输出一个整数:可以收集到的垃圾的最大总重量。

数据范围

  • $1 \le N \le 10^5$
  • $1 \le W, H \le 10^9$
  • $0 \le x_i, y_i < 10^9$,对于所有 $1 \le i \le N$
  • $1 \le w_i \le 10^9$,对于所有 $1 \le i \le N$

子任务

  1. (10 分) $N \le 400$
  2. (12 分) $W, H, x_i, y_i < 2000$,对于所有 $1 \le i \le N$
  3. (15 分) $N \le 2000$
  4. (22 分) $H = 10^9$
  5. (23 分) $W, H, x_i, y_i < 10^5$,对于所有 $1 \le i \le N$
  6. (18 分) 无附加限制

样例

输入 1

5 3 2
3 1 10
2 1 5
1 0 5
0 2 10
1 3 5

输出 1

20

说明

最优区域覆盖了位于 $(3, 1)$、$(2, 1)$ 和 $(1, 0)$ 的垃圾,总重量为 $10 + 5 + 5 = 20$。

图 1:样例

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.