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

Hiring

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

의견: 0

설명

August 8 – 15, Plovdiv, Bulgaria

Contest Day 1 - Hiring

English 1.1

HIRING

You have to hire workers for a construction project. There are N candidates applying for the job,
numbered from 1 to N inclusive. Each candidate k requires that if he is hired, he must be paid at
least Sk dollars. Also, each candidate k has a qualification level Qk. The regulations of the
construction industry require that you pay your workers in proportion to their qualification level,
relative to each other. For example, if you hire two workers A and B, and QA = 3 * QB, then you
have to pay worker A exactly three times as much as you pay worker B. You are allowed to pay
your workers non-integer amounts of money. This even includes quantities that cannot be written
with a finite number of digits in decimal form, such as a third or a sixth of a dollar.

You have W dollars at hand and you want to hire as many workers as possible. You decide
whom to hire and how much to pay them, but you have to meet the minimum salary
requirements of those you choose to hire, and you have to obey the industry regulations. You
also have to fit within your budget of W dollars.

The nature of your project is such that the qualification level is completely irrelevant, so you are
only interested in maximizing the number of workers without regard to their qualification level.
However, if there is more than one way to achieve this, then you want to select the one where
the total amount of money you have to pay your workers is as small as possible. In case there is
more than one way to achieve this, then you are indifferent among these ways and you would be
satisfied with any one of them.

TASK
Write a program that, given the different salary requirements and qualification levels of the
candidates, as well as the amount of money you have, determines which candidates you should
hire. You must hire as many of them as possible and you must do so with as little money as
possible, while complying with the industry regulations specified above.

EXAMPLES

Sample Input

Sample Output
4 100
5 1000
10 100
8 10
20 1
2
2
3

The only combination for which you can afford to hire two workers and still meet all the
constraints is if you select workers 2 and 3. You can pay them 80 and 8 dollars respectively and
thus fit in your budget of 100.

Sample Input

Sample Output
3 4
1 2
1 3
1 3
3
1
2
3

Here you can afford to hire all three workers. You pay 1 dollar to worker 1 and 1.50 dollars each
to workers 2 and 3, and you manage to hire everyone with the 4 dollars that you have.

Sample Input

Sample Output
3 40
10 1
10 2
10 3
2
2
3

Here you cannot afford to hire all three workers, as it would cost you 60 dollars, but you can
afford to hire any two of them. You choose to hire workers 2 and 3 because they would cost you
the smallest sum of money, compared to the other two-worker combinations. You can pay 10
dollars to worker 2 and 15 dollars to worker 3 for a total of 25 dollars. If you were to hire workers
1 and 2 you would have to pay them at least 10 and 20 dollars respectively. If you were to hire 1
and 3, then you would have to pay them at least 10 and 30 dollars respectively.

제약

1 ≤ N ≤ 500,000

The number of candidates
1 ≤ Sk ≤ 20,000

The minimum salary requirement of candidate k
1 ≤ Qk ≤ 20,000

The qualification level of candidate k
1 ≤ W ≤ 10,000,000,000
The amount of money available to you

IMPORTANT NOTE
The maximum value of W does not fit in 32 bits. You have to use a 64-bit data type, such as
long long in C/C++ or int64 in Pascal, in order to store the value of W in a single variable.
Please see the technical info sheet for details.

입력 형식

Your program must read from standard input the following data:
• The first line contains the integers N and W, separated by a space.
• The next N lines describe the candidates, one candidate per line. The kth of these lines
describes candidate number k and it contains the integers Sk and Qk, separated by a space.

August 8 – 15, Plovdiv, Bulgaria

Contest Day 1 - Hiring

English 1.1

출력 형식

Your program must write to standard output the following data:
• The first line must contain a single integer H, the number of workers that you hire.
• The next H lines must list the identifying numbers of the candidates you choose to hire (each
of them a different number between 1 and N), one per line, in any order.

GRADING
For any given test case, you will receive full points if your choice of candidates enables you to
achieve all of your goals, while satisfying all constraints. If you produce an output file with a
correct first line (i.e., a correct value of H), but which does not meet the above description, you
will receive 50% of the points for that test case. The latter will be the case even if the output file
is not properly formatted, as long as the first line is correct.

For a number of tests, worth a total of 50 points, N will not exceed 5,000.

문제 정보

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

출처 IOI 2009

평가 및 의견

Hiring

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

Log in to rate problems.

개별 의견

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

풀이 제출

Hiring

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