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

B. Buffed Buffet

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
Unrated 레이팅 미적용
난이도
4s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

You are buying lunch at a buffet. A number of different dishes are available, and you can mix and match them to your heart’s desire. Some of the dishes, such as dumplings and roasted potatoes, consist of pieces of roughly equal size, and you can pick an integral number of such pieces (no splitting is allowed). Refer to these as “discrete dishes.” Other dishes, such as tzatziki or mashed potatoes, are fluid and you can pick an arbitrary re\(al-va\)lued amount of them. Refer to this second type as “continuous dishes.” Of course, you like some of the dishes more than others, but how much you like a dish also depends on how much of it you have already eaten. For instance, even if you generally prefer dumplings to potatoes, you might prefer a potato over a dumpling if you have already eaten ten dumplings. To model this, each dish \(i\) has an initial tastiness \(t_{i}\), and a rate of decay of the tastiness ∆\(t_{i}\). For discrete dishes, the tastiness you experience when eating the \(n^{th}\) item of the dish is \(t_{i}\) −(\(n - 1\))∆\(t_{i}\). For continuous dishes, the tastiness you experience when eating an infinitesimal amount \(dx\) grams of the dish after already having eaten \(x\) grams is (\(ti - x\)\(ti\))\(dx\). In other words, the respective total amounts of tastiness you experience when eating \(N\) items of a discrete dish or \(X\) grams of a continuous dish are as follows: \(N\) X \(n=1\) (\(t_{i}\) −(\(n - 1\))∆\(t_{i}\)) and Z _{X} (\(t_{i} - x\)\(t_{i}\))\(dx\) For simplicity, do not take into account that different dishes may or may not go well together, so define the total tastiness that you experience from a meal as the sum of the total tastinesses of the individual dishes in the meal (and the same goes for the weight of a meal – there are no food antiparticles in the buffet!). You have spent days of painstaking research determining the numbers \(ti\) and ∆\(ti\) for each of the dishes in the buffet. All that remains is to compute the maximum possible total tastiness that can be achieved in a meal of weight \(w\). Better hurry up, lunch is going to be served soon!

제약
입력 형식

The input consists of a single test case. The first line of input consists of two integers \(d\) and \(w\) (\(1 \le d \le 250\) and \(1 \le w \le 10\,000\)), where \(d\) is the number of different dishes at the buffet and \(w\) is the desired total weight of your meal in grams. Then follow \(d\) lines, the \(i^{th}\) of which describes the \(i^{th}\) dish. Each dish description is in one of the following two forms:

  • A description of the form “D \(wi\) \(ti\)\(ti\)” indicates that this is a discrete dish where each item weighs \(wi\) grams, with initial tastiness \(ti\) and decay of tastiness ∆\(ti\).

  • A description of the form “C \(t_{i}\)\(t_{i}\)” indicates that this is a continuous dish with initial tastiness \(ti\) and decay of tastiness ∆\(ti\). The numbers \(wi\), \(ti\), and ∆\(ti\) are integers satisfying \(1 \le wi \le 10\,000\) and \(0 \le ti\), ∆\(ti \le 10\,000\).

출력 형식

Display the maximum possible total tastiness of a meal of weight \(w\) based on the available dishes. Give the answer with a relative or absolute error of at most \(10^{−}^{6}\). If it is impossible to make a meal of total weight exactly \(w\) based on the available dishes, display impossible.

예제 1
입력
2 15
D 4 10 1
C 6 1
출력
40.500000000
예제 2
입력
3 15
D 4 10 1
C 6 1
C 9 3
출력
49.000000000
예제 3
입력
2 19
D 4 5 1
D 6 3 2
출력
impossible
문제 정보

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

출처 ICPC World Finals 2014

평가 및 의견

B. Buffed Buffet

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

Log in to rate problems.

개별 의견

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

풀이 제출

B. Buffed Buffet

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