| Almaty Code Cup 2024 |
|---|
| Finished |
Shenfe1 accidentally stumbled upon a hedgehog clearing during RO 2023. Initially, there are no hedgehogs in the clearing. Each of the $$$n$$$ ($$$1 \leq n \leq 300$$$) hedgehogs has three characteristics. The $$$i$$$-th hedgehog has three characteristics: $$$L_i$$$ ($$$1 \leq L_i \leq 10^8$$$), $$$C_i$$$ ($$$-10^8 \leq C_i \leq 10^8$$$) and speed. If $$$i \lt j$$$, then the hedgehog number $$$i$$$ is faster than the hedgehog number $$$j$$$. Also, it is guaranteed that all $$$L_i$$$ are unique.
In the $$$L_i$$$-th minute, the $$$i$$$-th hedgehog arrives at the clearing, and if it is still in the clearing, then after $$$T$$$ ($$$1 \leq T \leq 10^8$$$) minutes it will leave. Note that all hedgehogs are in the clearing for the same amount of time, and that the $$$i$$$-th hedgehog will still be in the clearing at time $$$L_i + T$$$.
Shenfe1 can, at any time, if there is at least one hedgehog in the clearing, throw them food. In this case, if the $$$i$$$-th hedgehog is the fastest hedgehog in the clearing, then it takes the food and leaves, and $$$C_i$$$ irritation is added to Shenfe1's mood. The time of throwing food, picking up food and the arrival/departure of the hedgehog can be neglected.
Shenfe1 wants to know what the maximum irritation he can get in the worst case, if his initial irritation is 0.
The first line gives 2 numbers: $$$n$$$ ($$$1 \leq n \leq 300$$$) and $$$T$$$ ($$$1 \leq T \leq 10^8$$$).
The next $$$n$$$ lines follow the description of the hedgehogs. The $$$i$$$-th line contains the characteristics of the $$$i$$$-th hedgehog: $$$L_i$$$ and $$$C_i$$$ ($$$1 \leq L_i \leq 10^8, -10^8 \leq C_i \leq 10^8$$$). It is guaranteed that all $$$L_i$$$ are unique.
Output a single number, the maximum irritation that Shenfe1 can get.
5 31 -53 -82 1510 911 -10
19
4 43 -31 -27 -25 5
3
| Name |
|---|


