CF865G.Flowers and Chocolate

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

It's Piegirl's birthday soon, and Pieguy has decided to buy her a bouquet of flowers and a basket of chocolates.

The flower shop has F different types of flowers available. The i-th type of flower always has exactly p__i petals. Pieguy has decided to buy a bouquet consisting of exactly N flowers. He may buy the same type of flower multiple times. The N flowers are then arranged into a bouquet. The position of the flowers within a bouquet matters. You can think of a bouquet as an ordered list of flower types.

The chocolate shop sells chocolates in boxes. There are B different types of boxes available. The i-th type of box contains c__i pieces of chocolate. Pieguy can buy any number of boxes, and can buy the same type of box multiple times. He will then place these boxes into a basket. The position of the boxes within the basket matters. You can think of the basket as an ordered list of box types.

Pieguy knows that Piegirl likes to pluck a petal from a flower before eating each piece of chocolate. He would like to ensure that she eats the last piece of chocolate from the last box just after plucking the last petal from the last flower. That is, the total number of petals on all the flowers in the bouquet should equal the total number of pieces of chocolate in all the boxes in the basket.

How many different bouquet+basket combinations can Pieguy buy? The answer may be very large, so compute it modulo 1000000007 = 109 + 7.

很快就是 Piegirl 的生日了,Pieguy 决定为她买一束花和一篮巧克力。

花店共有 FF 种不同的花可供选择。第 ii 种花恰好有 pip_i 片花瓣。Pieguy 决定购买恰好 NN 朵花组成一束花束。他可以多次购买同一种花。这 NN 朵花将被排列成一束花束,花在花束中的位置是有意义的。你可以将一束花束视为一个有序的花种类列表。

巧克力店以盒装形式出售巧克力。共有 BB 种不同的巧克力盒可供选择。第 ii 种盒子包含 cic_i 块巧克力。Pieguy 可以购买任意数量的盒子,并且可以多次购买同一种盒子。然后他将这些盒子放入一个篮子中,盒子在篮子中的位置是有意义的。你可以将这个篮子视为一个有序的盒子种类列表。

Pieguy 知道 Piegirl 在吃每一块巧克力之前,都喜欢先从一朵花上摘下一片花瓣。他希望确保 Piegirl 恰好在摘下最后一朵花的最后一片花瓣之后,吃掉最后一个盒子中的最后一块巧克力。也就是说,花束中所有花朵的花瓣总数必须等于篮子中所有盒子的巧克力总块数。

Pieguy 一共可以购买多少种不同的“花束 + 篮子”组合?答案可能非常大,请对 1000000007=109+71000000007 = 10^9 + 7 取模。

输入格式

The first line of input will contain integers F, B, and N (1 ≤ F ≤ 10, 1 ≤ B ≤ 100, 1 ≤ N ≤ 1018), the number of types of flowers, the number of types of boxes, and the number of flowers that must go into the bouquet, respectively.

The second line of input will contain F integers _p_1, _p_2, ..., p__F (1 ≤ p__i ≤ 109), the numbers of petals on each of the flower types.

The third line of input will contain B integers _c_1, _c_2, ..., c__B (1 ≤ c__i ≤ 250), the number of pieces of chocolate in each of the box types.

输入的第一行包含三个整数 FF、BB 和 NN(1 ≤ F ≤ 101 ≤ F ≤ 10,1 ≤ B ≤ 1001 ≤ B ≤ 100,1 ≤ N ≤ 10181 ≤ N ≤ 10^{18}),分别表示花的种类数、盒子的种类数以及花束中必须包含的花朵总数。

输入的第二行包含 FF 个整数 p1, p2, ..., pFp_1,\,p_2,\,...,\,p_F(1 ≤ pi ≤ 1091 ≤ p_i ≤ 10^9),表示每种花的花瓣数量。

输入的第三行包含 BB 个整数 c1, c2, ..., cBc_1,\,c_2,\,...,\,c_B(1 ≤ ci ≤ 2501 ≤ c_i ≤ 250),表示每种盒子中的巧克力块数。

输出格式

Print the number of bouquet+basket combinations Pieguy can buy, modulo 1000000007 = 109 + 7.

输出 Pieguy 可以购买的花束 + 花篮组合的数量,对 1000000007=109+71000000007 = 10^9 + 7 取模。

输入输出样例

  • 输入#1

    2 3 3
    3 5
    10 3 7

    输出#1

    17
  • 输入#2

    6 5 10
    9 3 3 4 9 9
    9 9 1 6 4

    输出#2

    31415926

说明/提示

In the first example, there is 1 way to make a bouquet with 9 petals (3 + 3 + 3), and 1 way to make a basket with 9 pieces of chocolate (3 + 3 + 3), for 1 possible combination. There are 3 ways to make a bouquet with 13 petals (3 + 5 + 5, 5 + 3 + 5, 5 + 5 + 3), and 5 ways to make a basket with 13 pieces of chocolate (3 + 10, 10 + 3, 3 + 3 + 7, 3 + 7 + 3, 7 + 3 + 3), for 15 more combinations. Finally there is 1 way to make a bouquet with 15 petals (5 + 5 + 5) and 1 way to make a basket with 15 pieces of chocolate (3 + 3 + 3 + 3 + 3), for 1 more combination.

Note that it is possible for multiple types of flowers to have the same number of petals. Such types are still considered different. Similarly different types of boxes may contain the same number of pieces of chocolate, but are still considered different.

在第一个例子中,制作一朵有 9 片花瓣的花束有 1 种方式(3+3+33 + 3 + 3),制作一个装有 9 块巧克力的礼盒也有 1 种方式(3+3+33 + 3 + 3),因此共有 11 种组合。
制作一朵有 13 片花瓣的花束有 3 种方式(3+5+53 + 5 + 5,5+3+55 + 3 + 5,5+5+35 + 5 + 3),而制作一个装有 13 块巧克力的礼盒有 5 种方式(3+103 + 10,10+310 + 3,3+3+73 + 3 + 7,3+7+33 + 7 + 3,7+3+37 + 3 + 3),因此额外增加了 1515 种组合。
最后,制作一朵有 15 片花瓣的花束有 1 种方式(5+5+55 + 5 + 5),制作一个装有 15 块巧克力的礼盒也有 1 种方式(3+3+3+3+33 + 3 + 3 + 3 + 3),因此又增加了 11 种组合。

注意:多种花卉类型可能具有相同数量的花瓣,但这些类型仍被视为不同。类似地,不同类型的礼盒可能装有相同数量的巧克力块,但仍被视为不同。

输入解题思路,AI测评打分。不知道怎么写?

首页