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

Akcija

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

의견: 0

설명

Christmas, a time for giving. Mr. Malnar is in need of gift ideas. Although deep in
thought, the television program grabs his attention: “Special offer! This amazing
product is on sale for just \(w\) kunas. Call now because the offer is available only
if you call within the next \(d\) minutes. But that’s not all...”
There are \(n\) different products on sale, where the \(i-th\) product has a cost of \(w@@RISE_MATH_BLOCK_0@@i\) (inclusive). Making a call to place
an order requires one minute. A subset of products is called obtainable if it is possible to make a sequence
of calls which order those products while meeting the mentioned deadlines. No product can be ordered
more than once.
Mr. Malnar intends to buy as many products as possible, at the least possible price, but he’s not yet
sure which products he should buy. He compares two obtainable subsets in the following way: the better
obtainable subset is the one with more products, and if they have equal size, it’s the one that has a smaller
total cost (sum of costs of chosen products).
Mr. Malnar will rank the obtainable subsets in the described manner and he will take into consideration \(k\)
of the best ones. Write a program which determines the size and the total cost for \(k\) of the best obtainable
subsets.

제약

Subtask 1 (10 points): \(k = 1\), \(w_{1}\) = ... = \(w_{n}\)

Subtask 2 (20 points): \(k = 1\)

Subtask 3 (20 points): \(k = 2\)

Subtask 4 (10 points): \(1 \le n \le 20\)

Subtask 5 (30 points): \(1 \le n\), \(k \le 100\)

Subtask 6 (20 points): No additional constraints.

입력 형식

The first line contains positive integers \(n\) and \(k - th\)e number of different products and the number of
obtainable subsets to be taken into consideration, respectively. \(k\) will be less than or equal to the total
number of obtainable subsets.
The following \(n\) lines contain two positive integers \(w@@RISE_MATH_BLOCK_0@@i \le 10^{9}\)) and \(d@@RISE_MATH_BLOCK_1@@i \le n\)) - the cost of the
\(i-th\) product and the last minute for which the offers stands, respectively.

출력 형식

In the \(i-th\) line print the size and the total cost of the \(i-th\) best obtainable subset.

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

1

10점

\(k = 1\), \(w_{1}\) = ... = \(w_{n}\)

2

20점

\(k = 1\)

3

20점

\(k = 2\)

4

10점

\(1 \le n \le 20\)

5

30점

\(1 \le n\), \(k \le 100\)

6

20점

No additional constraints.

예제 1
입력
3 1
1 1
1 1
1 3
출력
2 2
예제 2
입력
4 3
1 1
10 1
2 3
10 3
출력
3 13
3 22
2 3
예제 3
입력
2 4
1 1
2 2
출력
2 3
1 1
1 2
0 0
설명

Clarification of the second example:
Products 1 and 2 can’t simultaneously be in an obtainable subset, so the three best obtainable subsets are
{1, 3, 4}, {2, 3, 4} i {1, 3}.

문제 정보

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

출처 COCI 2021/2022 Contest 3

평가 및 의견

Akcija

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

Log in to rate problems.

개별 의견

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

풀이 제출

Akcija

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