| UT Open 2025 |
|---|
| Finished |
The group has arrived in Austin! There they discover that the city council needs their help. However, they are very busy attending concerts so they've asked you to do this for them!
The city council of Austin is planning a large-scale urban renewal project along its East–West highway. There are $$$n$$$ proposed building expansions, each located at a distinct integer coordinate along the highway. Every proposal has an associated profit value. However, due to zoning regulations, any two chosen expansions must be sufficiently far apart. Specifically, if you approve the expansion at coordinate $$$x$$$, then you may not approve another expansion within distance $$$d$$$ of $$$x$$$.
Formally, you are given:
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$, $$$1 \leq d \leq 10^9$$$).
Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$p_i$$$ ($$$1 \leq x_i \leq 10^9$$$, $$$1 \leq p_i \leq 10^9$$$).
It is guaranteed that all $$$x_i$$$ are distinct.
Print a single integer: the maximum total profit you can achieve while respecting the spacing constraint.
6 23 15 47 18 29 112 5
12
| Name |
|---|


