#P14809. [CCPC 2024 哈尔滨站] 一个全新的几何问题
[CCPC 2024 哈尔滨站] 一个全新的几何问题
Description
You are a magician in a high-dimensional space, and you have an initial -dimensional hypercube with edge lengths . For a -dimensional hypercube, the edge length sum is defined as , and its hypervolume is .
You want to obtain a hypercube with edge length sum and hypervolume . To achieve this, you can perform both dimensional reduction and dimensional expansion operations on the current hypercube.
- Dimensional Reduction: Remove a dimension.
- Dimensional Expansion: Add a new dimension, with its edge length being any positive integer.
Both operations are very exhausting, so you want to determine the minimum number of operations required to obtain a hypercube with edge length sum and hypervolume .
Input Format
The first line contains three integers (, ).
The second line contains integers, representing the initial edge lengths of the hypercube ().
Output Format
Output a single integer representing the minimum number of operations required. If it is impossible to obtain a hypercube that meets the conditions, output .
2 5 6
1 2
2
3 6 5
1 2 3
3
2 114514 735134400
114 514
20
2 4 7
1 3
-1
Hint
For the first sample, one possible approach: first delete the dimension with edge length , and then add a dimension with edge length .
京公网安备 11011102002149号