QOJ.ac

QOJ

حد الوقت: 6.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 الصعوبة: [عرض]

#10003. 装饰鸟类

الإحصائيات

KAIST 校园里有 $n$ 只可爱的鹅。为了庆祝这些可爱的生物,KAIST 将为学生们举办“KAIST 鹅展”。展览的主要内容就是喂鹅并欣赏它们可爱的反应。

你有幸被选为学生代表喂鹅人。你的任务是通过最优地喂鹅,使展览尽可能可爱。第 $i$ 只鹅在时间 $T_i$ 到达你身边,并会焦急地等待食物时长 $L$。更准确地说,第 $i$ 只鹅在时间区间 $T_i \le x \le T_i + L$ 内可以进食。在时间 $T_i + L$ 之后,鹅会失去兴趣并离开。

第 $i$ 只鹅的速度为 $A_i$,可爱度为 $C_i$。没有两只鹅的速度相同。如果你在任何时间向等待的鹅投掷一块食物,其中速度最快的那只鹅会抢到它。然后这只鹅会自豪地展示它的可爱度供所有人观看,并将它的可爱度值加到展览的总可爱度得分中。注意,有些鹅比较吵闹,所以 $C_i$ 可能是负数。在吃掉一块食物后,这只鹅会感到满足并离开。

你可以自由地投掷任意数量的食物,在频率或数量上没有任何限制。你的目标是确定展览所能达到的最大可爱度得分。

输入格式

第一行包含两个整数 $n$ 和 $L$ ($1 \le n \le 3 \cdot 10^5$; $1 \le L \le 10^9$)。

接下来的 $n$ 行,每行包含三个空格分隔的整数:第 $i$ 行包含 $A_i$,$C_i$ 和 $T_i$ ($1 \le A_i \le n$; $-10^9 \le C_i \le 10^9$; $0 \le T_i \le 10^9$)。

输出格式

输出展览的最大可爱度得分。

样例

输入 1

6 5
6 -1 7
4 -5 9
1 3 11
5 -4 13
2 4 14
3 6 7

输出 1

9

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1742EditorialOpenNew Editorial for Problem #10003ZnPdCo2026-05-17 17:03:53View
#523Editorial Open集训队作业 解题报告 by 刘墨涵Qingyu2026-01-02 21:41:43 Download

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.