| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 512 MB | 4 | 4 | 4 | 100.000% |
There are $n$ cities and $m$ bidirectional roads in Byteland. These cities are labeled by $1,2,\dots,n$, the brightness of the $i$-th city is $b_i$.
Magician Sunset wants to play a joke on Byteland by making a total eclipse such that the brightness of every city becomes zero. Sunset can do the following operation any number of times:
Sunset will always choose the maximum possible value of $k$ for each operation. Now Sunset is wondering what is the minimum number of operations he needs to do, please write a program to help him.
The first line contains a single integer $T$ ($1 \leq T \leq 10$), the number of test cases. For each test case:
The first line contains two integers $n$ and $m$ ($1 \leq n \leq 100\,000$, $1\leq m\leq 200\,000$), denoting the number of cities and the number of roads.
The second line contains $n$ integers $b_1,b_2,\dots,b_n$ ($1\leq b_i\leq 10^9$), denoting the brightness of each city.
Each of the following $m$ lines contains two integers $u_i$ and $v_i$ ($1\leq u_i,v_i\leq n$, $u_i\neq v_i$) denoting a bidirectional road between the $u_i$-th city and the $v_i$-th city. Note that there may be multiple roads between the same pair of cities.
For each test case, output a single line containing an integer: the minimum number of operations.
1 3 2 3 2 3 1 2 2 3
4