当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6355:Fireflies

题目描述
Randal is a master of high-dimensional space. All the species living in his space are regarded as fireflies for him. One day he came up with a problem but failed to solve it. Are you the one who can solve that?
There is one $n$-dimensional hypercubic subspace that he wants to cover by the minimal number of fireflies. The side lengths of the space are $p_1, p_2, \cdots, p_n$, which means this space can be formed into $\prod_{i = 1}^{n}{p_i}$ hypercubic units.
One unit is considered as covered if there exists a firefly that has visited it. Each firefly is able to cover several units through its own traveling. Assuming a firefly is located at the coordinate $(x_1, x_2, \cdots, x_n)$ with $1 \leq x_i \leq p_i$ $(i = 1, 2, \cdots, n)$, it can move to another coordinate $(y_1, y_2, \cdots, y_n)$ if $1 \leq x_i \leq y_i \leq p_i$ $(i = 1, 2, \cdots, n)$ and $\sum_{i = 1}^{n}{|x_i - y_i|} = 1$. In addition, The travel of one firefly can start or end at any location and might have any times of moves but one firefly could only travel once.
Your task is to determine the minimum number of fireflies that should be involved and print the answer in modulo $(10^9 + 7)$.
输入解释
The first line contains one integer $T$, indicating the number of test cases.
The following lines describe all the test cases. For each test case:
The first line contains one integer $n$, indicating the dimension of the space.
The second line contains $n$ space-separated integers, indicating the side lengths of the space.
$1 \leq T \leq 2000$, $1 \leq n \leq 32$, $1 \leq p_i \leq 10^9$ $(i = 1, 2, \cdots, n)$.
It is guaranteed that no more than $200$ test cases satisfy $n > 8$, no more than $20$ test cases satisfy $n > 16$ and no more than $2$ test cases satisfy $n > 24$.
输出解释
For each test case, print the answer modulo $(10^9 + 7)$ in one line.
输入样例
3
1
10
2
3 4
3
3 3 3
输出样例
1
3
7

提示
For the first sample, one firefly could cover all the units.
For the second sample, one possible best way is that each firefly covers all the units with the same second coordinate, which involves three fireflies.
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6355

最后修改于 2020-10-25T23:30:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000/2500MS(Java/Others) 262144/262144K(Java/Others)