Codeforces Round 284 (Div. 1)
C
Array and Operations
Codeforces
2100
原题
← BD →
翻译中…

You have written on a piece of paper an array of $*n*$ positive integers $*a*[1], *a*[2], ..., *a*[*n*]$ and $*m*$ good pairs of integers $(*i*_{1}, *j*_{1}), (*i*_{2}, *j*_{2}), ..., (*i*_{*m*}, *j*_{*m*})$. Each good pair $(*i*_{*k*}, *j*_{*k*})$ meets the following conditions: $*i*_{*k*} + *j*_{*k*}$ is an odd number and $1 ≤ *i*_{*k*} < *j*_{*k*} ≤ *n*$.

翻译中…

In one operation you can perform a sequence of actions:

翻译中…
  • take one of the good pairs $(*i*_{*k*}, *j*_{*k*})$ and some integer $*v*$ ($*v* > 1$), which divides both numbers $*a*[*i*_{*k*}]$ and $*a*[*j*_{*k*}]$;
  • divide both numbers by $*v*$, i. e. perform the assignments: image and image.
翻译中…

Determine the maximum number of operations you can sequentially perform on the given array. Note that one pair may be used several times in the described operations.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$, $*m*$ ($2 ≤ *n* ≤ 100$, $1 ≤ *m* ≤ 100$).

翻译中…

The second line contains $*n*$ space-separated integers $*a*[1], *a*[2], ..., *a*[*n*]$ ($1 ≤ *a*[*i*] ≤ 10^{9}$) — the description of the array.

翻译中…

The following $*m*$ lines contain the description of good pairs. The $*k*$-th line contains two space-separated integers $*i*_{*k*}$, $*j*_{*k*}$ ($1 ≤ *i*_{*k*} < *j*_{*k*} ≤ *n*$, $*i*_{*k*} + *j*_{*k*}$ is an odd number).

翻译中…

It is guaranteed that all the good pairs are distinct.

翻译中…

Output

翻译中…

Output the answer for the problem.

翻译中…

样例

Input #1
3 2
8 3 8
1 2
2 3
Output #1
0
InputCopy OutputCopy
Input #2
3 2
8 12 8
1 2
2 3
Output #2
2
InputCopy OutputCopy
题目信息
题号
498C
时间限制
1 s
内存限制
256 MB
标签
网络流
图匹配
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。