knightnemo commited on
Commit
c0b9cd5
·
verified ·
1 Parent(s): 89e6a51

Upload code_segments/segment_157.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_157.txt +20 -0
code_segments/segment_157.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ In his favorite cafe Kmes once again wanted to try the herring under a fur coat. Previously, it would not have been difficult for him to do this, but the cafe recently introduced a new purchasing policy.
2
+
3
+ Now, in order to make a purchase, Kmes needs to solve the following problem: $n$ cards with prices for different positions are laid out in front of him, on the $i$-th card there is an integer $a_i$, among these prices there is no whole positive integer $x$.
4
+
5
+ Kmes is asked to divide these cards into the minimum number of bad segments (so that each card belongs to exactly one segment). A segment is considered bad if it is impossible to select a subset of cards with a product equal to $x$. All segments, in which Kmes will divide the cards, must be bad.
6
+
7
+ Formally, the segment $(l, r)$ is bad if there are no indices $i_1 < i_2 < \ldots < i_k$ such that $l \le i_1, i_k \le r$, and $a_{i_1} \cdot a_{i_2} \ldots \cdot a_{i_k} = x$.
8
+
9
+ Help Kmes determine the minimum number of bad segments in order to enjoy his favorite dish.
10
+
11
+ The first line contains a single integer $t$ ($1 \le t \le 10^3$) — the number of test cases.
12
+
13
+ The first line of each set of input data gives you $2$ integers $n$ and $x$ ($1 \le n \le 10^5, 2 \le x \le 10^5$) — the number of cards and the integer, respectively.
14
+
15
+ The second line of each set of input data contains $n$ integers $a_i$ ($1 \le a_i \le 2 \cdot 10^5, a_i \neq x$) — the prices on the cards.
16
+
17
+ It is guaranteed that the sum of $n$ over all sets of test data does not exceed $10^5$.
18
+
19
+ For each set of input data, output the minimum number of bad segments.
20
+