| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 (추가 시간 없음) | 1024 MB | 26 | 6 | 5 | 27.778% |
There are $N$ adorable geese in KAIST campus. To celebrate these lovely creatures, KAIST will host “KAIST Geese Show” for students. The main contents of the show is simply feeding the geese and enjoying their delightful reactions.
You have the honor of being chosen as the representative feeder. Your mission is to make the show as cute as possible by feeding the geese optimally. The $i$-th goose approaches you at time $T_i$ and will eagerly wait for food for a duration of $L$. More precisely, the $i$-th goose is available to eat food during the time interval $T_i\le x\le T_i+L$. After time $T_i+L,ドル the goose will lose interest and leave.
The $i$-th goose has speed level of $A_i$ and cuteness of $C_i$. If you throw a food to the awaiting geese at any time, the fastest goose (highest $A_i$) among those will take it. Then the goose will proudly display its cuteness for all to see, adding its cuteness value to the overall cuteness score of the show. After consuming a food, the goose will satisfy and leave. Note that there are no two geese having same speed level. Also, there can be some noisy goose, so $C_i$ may be negative.
You have the freedom to throw as much food as you desire, with no constraints on frequency or quantity. Your goal is to determine the maximum cuteness score achievable for the show.
The first line contains space-separated two integers, $N,ドル $L$.
The next $N$ lines contain space-separated three integers, the $i$-th line contains $A_i,C_i,T_i$.
Output the maximum cuteness score of the show.
6 5 6 -1 7 4 -5 9 1 3 11 5 -4 13 2 4 14 3 6 7
9