포럼
문제 ICPC00172

B. Better Productivity

설명

ACME Inc. is reorganizing their factory, in order to maximize their productivity of useless trinkets. The new factory design consists of \(p\) independent and identical production lines. Each production line can be assigned some number of workers.

The actual work is of course all done by machines, so the production rate of a production line is independent of the actual number of workers assigned to it. However, the workers work in shifts, and due to local safety regulations, a production line can only be active while all of its workers are present (any worker who arrives before the last person to arrive, or leaves after the first person leaves, will be spending the inactive time having a coffee break). In other words, the productivity of a production line equals the length of the timespan during which all of the workers assigned to this production line are present. Crucially, the productivity of each line must be positive (i.e., the last worker to arrive for a line must arrive strictly before the first worker for that line leaves), since otherwise the workers feel that their jobs are meaningless.

Unfortunately, due to some pesky labor laws, ACME are not allowed to fire any of their workers, which means that each of their \(n\) workers must be assigned to some production line, even though this may actually decrease the overall productivity of the factory.

All these rules and regulations are making a headache for ACME management. Can you help them figure out the maximum possible total productivity (sum of productivities of the \(p\) production lines) of their new factory?

제약
입력 형식

The input consists of:
- one line containing two integers \(n\) and \(p\) (\(1 \le p \le n \le 200\)), the number of employees and the number of production lines;
- \(n\) lines each containing two integers \(a\) and \(b\) (\(0 \le a < b \le 100\,000\)), representing a worker that arrives at time \(a\) and leaves at time \(b\).

You may assume that there exists at least one valid assignment of workers to production lines.

출력 형식

Output the maximum productivity level possible for the factory.

예제 1
입력
4 2
1 3
1 5
4 6
2 7
출력
4
문제 정보

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

출처 ICPC NWERC 2015

평가 및 의견

B. Better Productivity

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

Log in to rate problems.

개별 의견

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

풀이 제출

B. Better Productivity

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