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

26493번 - Tennis 서브태스크다국어

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

문제

Little MP loves watching tennis tournaments with his family and friends. He has recently watched the Australian Open 2022 Finals on TV and noticed that each tennis ball used by the players must have an integer weight from 0ドル$ to $w - 1,ドル inclusive. Moreover, there may be several different models of balls with each weight. For weight $i,ドル there exist $v_i$ different models with this weight.1 We consider that any two balls with the same weight and model are identical.

Little MP goes to InfO(1)Sports, one of his favorite sports shops from his hometown, and enthusiastically finds out that there is an infinite supply for every single tennis ball model he saw on TV the last month. In other words, for each weight $i,ドル there are infinitely many balls for each of the $v_i$ models with that weight.

Little MP wants to buy $n$ tennis balls, but he has a constraint on this purchase. Suppose he buys the balls with weights $w_1, \dots , w_n$ and models $m_1, \dots , m_n,ドル respectively. He then requires that: $$(w_1 + \dots + w_n) \mod w ≤ x\text{.}$$

Furthermore, the sports shop has a very strange way of determining the prices of the balls. The price of the sequence of the $n$ balls mentioned above is given by $count^k,ドル where $count$ is the number of balls from the sequence with weight at most $y$.

Little MP is now curious about something: if we consider all the possible sequences of $n$ balls that satisfy Little MP’s requirements, what is the sum of their costs? (A sequence may contain multiple identical balls; the order matters within such a sequence. For example, if $(w, m)$ denotes a ball with weight $w$ and model $m,ドル then the sequence $(1, 2),ドル $(2, 1)$ is different from the sequence $(2, 1),ドル $(1, 2)$. Thus, two sequences are considered identical if and only if they contain identical balls on all positions.)


1We use the convention that if $v_i = 0,ドル then no ball with weight $i$ was used at the tennis tournament.

입력

The first line of the input contains the integers $n,ドル $w,ドル $k,ドル $x,ドル and $y$. The second line of the input contains the integers $v_0, v_1, \dots , v_{w-1},ドル representing the number of different models of tennis balls with each weight, as described above.

출력

The only line of the output contains just one number: the sum of the costs of all the possible sequences of $n$ balls that satisfy Little MP’s requirements modulo 10ドル^9 + 7$.

제한

  • 1ドル ≤ n ≤ 10^9$
  • 1ドル ≤ w ≤ 700$
  • 0ドル ≤ v_0, v_1, \dots , v_{w-1} ≤ 10^9$
  • 1ドル ≤ k ≤ 2$
  • 0ドル ≤ x, y < w$

서브태스크

번호배점제한
17

$n ≤ 10^6,ドル $x = w - 1,ドル $y = w - 1$

22

$x = w - 1,ドル $y = w - 1$

310

$v_0 = v_1 = \cdots = v_{w-1} = 0$

415

$n ≤ 50,ドル $w ≤ 50$

54

$n ≤ 2500,ドル $w ≤ 50,ドル $y = w - 1$

65

$y = w - 1,ドル $v_0 = v_1 = \cdots = v_{w-1}$

711

$n ≤ 2500,ドル $w ≤ 50,ドル $k = 1$

87

$w ≤ 50,ドル $k = 1$

912

$n ≤ 2500,ドル $w ≤ 50,ドル $k = 2$

107

$w ≤ 50,ドル $k = 2$

119

$k = 1$

1211

$k = 2$

예제 입력 1

7 3 2 1 1
0 0 0

예제 출력 1

0

예제 입력 2

1000000 4 1 2 1
0 0 0 0

예제 출력 2

0

예제 입력 3

1 2 1 1 1
2 2

예제 출력 3

4

예제 입력 4

1 2 2 1 1
2 2

예제 출력 4

4

예제 입력 5

2 2 1 1 1
2 2

예제 출력 5

32

예제 입력 6

1 3 1 1 1
1 1 1

예제 출력 6

2

예제 입력 7

3 2 1 1 1
25 37

예제 출력 7

714984

예제 입력 8

6 5 2 3 2
1 2 6 70 1

예제 출력 8

227678571

예제 입력 9

6 5 1 2 3
1 6 70 1 4

예제 출력 9

398503624

예제 입력 10

500 4 1 2 3
10 20 30 40

예제 출력 10

651382141

힌트

We denote a ball with weight $w$ and model $m$ with $(w, m)$.

In the first two examples, there are no balls at all. Thus, there are no sequences of balls that can be bought, and the sum of their costs is 0ドル$.

In the third and fourth examples, the balls are $(0, 1),ドル $(0, 2),ドル $(1, 1),ドル $(1, 2)$. Little MP could buy $(0, 1),ドル or $(0, 2),ドル or $(1, 1),ドル or $(1, 2)$. Each of these sequences has cost a cost equal to 1ドル$ in both examples (since 1ドル^1 = 1^2 = 1$). Thus, the total cost is 4ドル$.

In the fifth example, we have the same possible balls, and Little MP can buy any pair of balls. Thus, Little MP can buy 4ドル × 4 = 16$ sequences of balls. The cost of a pair of balls is the number of balls whose weight is at most 1ドル$ (i.e. all $n = 2$ of them) to the power of $k = 1,ドル so the cost is 2ドル$. Therefore, the sum of costs is 32ドル$.

In the next example, there are three possible balls, $(0, 1),ドル $(1, 1),ドル $(2, 1)$. Little MP can buy one ball whose weight is at most 1ドル$ modulo 3ドル,ドル so he can buy either $(0, 1)$ or $(1, 1)$. Both of these sequences have cost 1ドル,ドル so the total cost is 2ドル$.

출처

Contest > infO(1) Cup > infO(1) Cup 2022 E번

채점 및 기타 정보

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

출처

대학교 대회

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

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