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

21176번 - Smoothie Stand 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB134918166.942%

문제

Olivia runs a very famous and profitable smoothie stand. On any given day, she will always sell out (that is, she will sell as many smoothies as she has ingredients to make), regardless of what smoothie recipe she offers. Therefore, to simplify things, she has decided she will only make one type of smoothie per day. Now she has come to you to help her decide which of her recipes she should use today, given the ingredients she has on hand and the sale price of each type of smoothie.

입력

The first line contains two integers $k$ and $r,ドル separated by a space. The value $k$ is the number of different ingredients Olivia uses in her smoothies and $r$ is the number of different recipes she makes. You may assume 1ドル \le k \le 100,000円,ドル 1ドル \le r \le 100,000円,ドル and 1ドル \le kr \le 100,000円$. The second line contains $k$ integers, which represent the amount of each ingredient she currently has on hand. This is followed by $r$ lines, each of which represents a recipe. On each such line, the first $k$ space-separated integers represent the amount of each ingredient used in that recipe. This is followed by one integer representing the price charged for one smoothie of that recipe.

You may assume that all values, except possibly $k$ and $r,ドル are nonnegative integers less than or equal to 10ドル^4$. It is guaranteed that each recipe uses at least one ingredient.

출력

Output the largest total sales revenue that can be obtained by choosing a single recipe and making as many of that recipe as possible.

제한

예제 입력 1

3 2
5 10 10
1 4 1 5
3 3 3 3

예제 출력 1

10

예제 입력 2

4 3
10 9 8 7
0 1 2 4 10
3 1 1 2 4
2 0 3 3 5

예제 출력 2

12

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2020 Mid-Central Regional Programming Contest O번

  • 문제를 만든 사람: Zack Butler
(追記) (追記ここまで)

출처

대학교 대회

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

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