P16341 [USTC Guochuang Cup Junior 2026] Product
Background
Subtask 0 uses community testdata, and Subtask 1 uses official testdata.
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 $x$.
Input Format
The first line contains two positive integers $n, x$, representing the length of the sequence and the target product.
The second line contains $n$ positive integers $a_1, \dots, a_n$, representing Xiaokeke's sequence.
Output Format
If you cannot find a consecutive segment whose product equals $x$, output `-1`.
Otherwise, output two numbers $l, r$ ($l \le r$) such that $a_l \times a_{l+1} \times \dots \times a_r = x$.
If there are multiple valid pairs $(l, r)$, output the one with the smallest $l$. If the smallest $l$ is the same, output the one with the smallest $r$.
Explanation/Hint
#### Other Sample Notes
* **Sample 3 ~ 4**: See `multiply/multiply*.in` and `multiply/multiply*.ans` in the contestant directory.
#### Constraints
* For $30\%$ of the data, $n = 2$.
* For another $30\%$ of the data, $x = 1$.
* For $100\%$ of the data, $n \le 100$, $1 \le a_i, x \le 10^4$.
Translated by ChatGPT 5