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

28493번 - Burgers 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB156473940.206%

문제

Kai the lobster is starting a burger chain selling burgers. He has $n$ ingredients to work with, which are labelled from 1ドル$ to $n$. For each ingredient $i,ドル he has $x[i]$ portions of ingredient $i$.

He has two recipes for burgers. For each ingredient $i,ドル the first recipe requires $a[i]$ portions of ingredient $i$ and the second recipe requires $b[i]$ portions of ingredients $i$.

Can you help Kai compute the maximum total number of burgers he can make?

입력

The first line of input consists of one integer $n,ドル the number of different ingredients.

The second line consists of $n$ spaced integers $x[1], x[2], \dots , x[n - 1], x[n],ドル the total number of portions Kai has of each ingredient.

The third line consists of $n$ spaced integers $a[1], a[2], \dots , a[n - 1], a[n],ドル the number of portions of each ingredient for the first recipe.

The fourth line consists of $n$ spaced integers $b[1], b[2], \dots , b[n - 1], b[n],ドル the number of portions of each ingredient for the second recipe.

출력

The output should contain a single integer on a single line, the largest number of burgers Kai can make.

제한

  • 1ドル ≤ n ≤ 100,000円$
  • 1ドル ≤ x[i], a[i], b[i] ≤ 10^9$

서브태스크

번호배점제한
19

$a[i] = b[i]$ (i.e. the two recipes are the same)

217

$n, x[i] ≤ 100$

325

$n, x[i] ≤ 1500$

449

No additional restrictions

예제 입력 1

3
14 10 100
3 1 1
2 3 1

예제 출력 1

5

He can make 3ドル$ burgers using the first recipe and 2ドル$ burgers using the second recipe for a total of 5ドル$ burgers.

예제 입력 2

2
83 72
1 3
1 3

예제 출력 2

24

He can make 24ドル$ burgers of either type, since both recipes are the same.

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > Qualification > NOI 2023 Qualification 4번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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