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

23949번 - Shifts 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
40 초 (추가 시간 없음) 1024 MB54322767.500%

문제

Aninda and Boon-Nam are security guards at a small art museum. Their job consists of N shifts. During each shift, at least one of the two guards must work.

The two guards have different preferences for each shift. For the i-th shift, Aninda will gain Ai happiness points if he works, while Boon-Nam will gain Bi happiness points if she works.

The two guards will be happy if both of them receive at least H happiness points. How many different assignments of shifts are there where the guards will be happy?

Two assignments are considered different if there is a shift where Aninda works in one assignment but not in the other, or there is a shift where Boon-Nam works in one assignment but not in the other.

입력

The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a line containing the two integers N and H, the number of shifts and the minimum happiness points required, respectively. The second line contains N integers. The i-th of these integers is Ai, the amount of happiness points Aninda gets if he works during the i-th shift. The third line contains N integers. The i-th of these integers is Bi, the amount of happiness points Boon-Nam gets if she works during the i-th shift.

출력

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the number of different assignments of shifts where the guards will be happy.

제한

  • 1 ≤ T ≤ 100.
  • 0 ≤ H ≤ 109.
  • 0 ≤ Ai ≤ 109.
  • 0 ≤ Bi ≤ 109.

Test Set 1 (20점)

  • 1 ≤ N ≤ 12.

Test Set 2 (23점)

  • 1 ≤ N ≤ 20.

예제 입력 1

2
2 3
1 2
3 3
2 5
2 2
10 30

예제 출력 1

Case #1: 3
Case #2: 0

힌트

In Sample Case #1, there are N = 2 shifts and H = 3. There are three possible ways for both Aninda and Boon-Nam to be happy:

  • Only Aninda works on the first shift, while both Aninda and Boon-Nam work on the second shift.
  • Aninda and Boon-Nam work on the first shift, while only Aninda works on the second shift.
  • Both security guards work on both shifts.

In Sample Case #2, there are N = 2 shifts and H = 5. It is impossible for both Aninda and Boon-Nam to be happy, so the answer is 0.

출처

Contest > Google > Kick Start > Google Kick Start 2019 > Round G C번

채점 및 기타 정보

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

출처

대학교 대회

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

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