Logo
(追記) (追記ここまで)

30295번 - Feeding Geese 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 1024 MB266527.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.

제한

  • 1ドル\le N\le 300,円 000$
  • 1ドル\le L\le 10^9$
  • 1ドル\le A_i\le N\ (1\le i\le N)$
  • $A_i\neq A_j$ if $i\neq j\ (1\le i,j\le N)$
  • $-10^9\le C_i\le 10^9\ (1\le i\le N)$
  • 0ドル\le T_i\le 10^9\ (1\le i\le N)$
  • All values in the input are integers.

예제 입력 1

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

예제 출력 1

9

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2023 KAIST 13th ICPC Mock Competition D번

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 2: K-ontest D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /