#P16341. [科大国创杯初中组 2026] 乘积
[科大国创杯初中组 2026] 乘积
Background
Subtask 0 uses community testdata, and Subtask 1 uses official testdata.
Problem Description
Xiaokeke has a sequence of positive integers. He wants to know whether it is possible to find a consecutive segment in this sequence whose product is equal to a positive integer .
Input Format
The first line contains two positive integers , representing the length of the sequence and the target product.
The second line contains positive integers , representing Xiaokeke's sequence.
Output Format
If you cannot find a consecutive segment whose product equals , output -1.
Otherwise, output two numbers () such that .
If there are multiple valid pairs , output the one with the smallest . If the smallest is the same, output the one with the smallest .
5 24
1 2 3 4 5
1 4
5 9
1 2 3 4 5
-1
Hint
Other Sample Notes
- Sample 3 ~ 4: See
multiply/multiply*.inandmultiply/multiply*.ansin the contestant directory.
Constraints
- For of the data, .
- For another of the data, .
- For of the data, , .
Translated by ChatGPT 5