Logo
(追記) (追記ここまで)

26969번 - Bribing Friends 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB54127719851.562%

문제

Bessie wants to watch Bovine Genomics: The Documentary, but she doesn’t want to go alone. Unfortunately, her friends aren’t enthusiastic enough to go with her! Therefore, Bessie needs to bribe her friends to accompany her to the movie theater. She has two tools in her bribery arsenal: mooney and ice cream cones.

Bessie has $N$ (1ドル \le N \le 2000$) friends. However, not all friends are created equal! Friend $i$ has a popularity score of $P_i$ (1ドル \le P_i \le 2000$), and Bessie wants to maximize the sum of the popularity scores of the friends accompanying her. Friend $i$ is only willing to accompany Bessie if she gives them $C_i$ (1ドル \le C_i \le 2000$) moonies. They will also offer her a discount of 1ドル$ mooney if she gives them $X_i$ (1ドル \le X_i \le 2000$) ice cream cones. Bessie can get as many whole-number discounts as she wants from a friend, as long as the discounts don’t cause the friend to give her mooney.

Bessie has $A$ moonies and $B$ ice cream cones at her disposal (0ドル \le A, B \le 2000$). Help her determine the maximum sum of the popularity scores she can achieve if she spends her mooney and ice cream cones optimally!

입력

Line 1ドル$ contains three numbers $N,ドル $A,ドル and $B,ドル representing the number of friends, the amount of mooney, and the number of ice cream cones Bessie has respectively.

Each of the next $N$ lines contains three numbers, $P_i,ドル $C_i,ドル and $X_i,ドル representing popularity ($P_i$), mooney needed to bribe friend $i$ to accompany Bessie ($C_i$), and ice cream cones needed to receive a discount of 1ドル$ mooney from friend $i$ ($X_i$).

출력

Output the maximum sum of the popularity scores of the friends accompanying Bessie, assuming she spends her moonie and ice cream cones optimally.

제한

예제 입력 1

3 10 8
5 5 4
6 7 3
10 6 3

예제 출력 1

15

힌트

Bessie can give 4ドル$ moonies and 4ドル$ ice cream cones to cow 1ドル,ドル and 6ドル$ moonies and 3ドル$ ice cream cones to cow 3ドル,ドル in order to get cows 1ドル$ and 3ドル$ to accompany her for a total popularity of 5ドル + 10 = 15$.

출처

Olympiad > USA Computing Olympiad > 2022-2023 Season > USACO 2022 December Contest > Gold 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /