RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00591

Autobahn

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Croatian Olympiad in Informatics
April \(25^{th}\) 2021
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.

제약

Subtask 1 (20 points): \(1 \le N\), K, X, l\(i\), t\(i\), r\(i \le 100\)

Subtask 2 (30 points): \(1 \le N\), K, X, l_{i}, t_{i}, \(r_{i} \le 1\,000\)

Subtask 3 (50 points): \(1 \le N \le 10^{5}\), \(1 \le X\), l\(i\), t\(i\), r\(i \le 10^{9}\)

입력 형식

First line contains integers \(N\), \(K\) and \(X\) (\(K \le N\)) from task description.
Next \(N\) lines contain integers \(l@@RISE_MATH_BLOCK_0@@i\) and \(r@@RISE_MATH_BLOCK_1@@i \le r\)\(i\)) from task description.

출력 형식

Print the required sum in a single line.

서브태스크
서브태스크점수설명

1

20점

\(1 \le N\), K, X, l\(i\), t\(i\), r\(i \le 100\)

2

30점

\(1 \le N\), K, X, l_{i}, t_{i}, \(r_{i} \le 1\,000\)

3

50점

\(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
출력
7
예제 2
입력
3 2 22
7 16 33
69 14 88
8 10 97
출력
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.
1 od 7
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2020/2021 Olympiad

평가 및 의견

Autobahn

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Autobahn

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8