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

21807번 - Autobahn 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB48131354.167%

문제

There are $N$ people testing their racing cars on notorious autobahn where limits do not exist. In this task however limits do exist. So we kindly ask you to restrain yourself from submitting exponential complexity solutions.

Person $i$ came to autobahn at the beginning of minute $l_i,ドル paid for $t_i$ minutes of stay and left at the end of minute $r_i$. Unfortunately some stayed for longer than that they have paid for. Administration of autobahn decided not to be very harsh and charge them only for those extra minutes in which there were at least $K$ people on autobahn.

In a rush of generosity, administration decided to introduce happy hour i.e. interval of continuous $X$ minutes for which they won’t be paying extra charges. They picked happy hour so that the sum of extra charges that won’t be paid is maximal possible. Determine that sum.

입력

First line contains integers $N,ドル $K$ and $X$ ($K \le N$) from task description.

Next $N$ lines contain integers $l_i,ドル $t_i$ and $r_i$ ($l_i \le r_i$) from task description.

출력

Print the required sum in a single line.

제한

서브태스크

번호배점제한
120

1ドル \le N, K, X, l_i, t_i, r_i \le 100$

230

1ドル \le N, K, X, l_i, t_i, r_i \le 1~000$

350

1ドル \le N \le 10^5, 1 \le X, l_i, t_i, r_i \le 10^9$

예제 입력 1

5 3 4
2 1 4
3 3 7
3 3 8
1 5 7
5 3 8

예제 출력 1

7

예제 입력 2

3 2 22
7 16 33
69 14 88
8 10 97

예제 출력 2

27

힌트

First sample explanation: Happy hour will span from 4th until the 7th minute. Inside that interval, first person should’ve paid extra for the 4th minute and second, third and fourth person should’ve paid for 6th and 7th minute.

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2021 > Croatian Olympiad in Informatics 2021 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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