| TheForces Round #19 (Briefest-Forces) |
|---|
| Закончено |
You are given three arrays $$$a,b,c$$$ of length $$$n$$$ and a number $$$m$$$.
Your task is to count the number of triples $$$(i,j,k)$$$ such that $$$a_i\times b_j \times c_k=m$$$.
The first line of input contains two numbers $$$n(1\le n\le 5\times 10^5),m(1\le m\le 10^9)$$$.
The second line contains $$$n$$$ numbers $$$a_1,a_2,\ldots,a_n(1\le a_i\le m)$$$.
The third line contains $$$n$$$ numbers $$$b_1,b_2,\ldots,b_n(1\le b_i\le m)$$$.
The fourth line contains $$$n$$$ numbers $$$c_1,c_2,\ldots,c_n(1\le c_i\le m)$$$.
Print the answer.
3 3 1 2 3 1 1 3 2 3 3
4
4 2 1 1 1 1 1 1 1 1 1 1 1 1
0
6 18 2 4 3 5 7 1 18 6 2 3 5 9 1 1 3 2 7 5
11
In the first example, there are four triples satisfy the condition: $$$(1,1,2),(1,2,2),(1,1,3),(1,2,3)$$$.
In the second example, it can be shown that there's no triple satisfy the condition.
| Название |
|---|


