F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Security Center

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 361    Accepted Submission(s): 123


Problem Description
Recently, wyh had learned a lot of knowledge about attack others¡¯ computers. Now, if he has a way to access someone¡¯s computer, the computers those connected directly or indirectly will suddenly be broken. To avoid it happening, the government set several computers with ¡°Security Center¡±. These computers can prevent wyh¡¯s attack. So they are called anti-wyhs. What¡¯s more, anti-wyhs can protect the computers those connect to them directly or indirectly from wyh¡¯s dreadful attack. But anti-wyhs can¡¯t connect to a computer indirectly through wyh¡¯s computer.

Now, the government asks you how many computers have been attacked.
 

Input
The input will start with a line giving the number of test cases, T.
The first line of each case contains three integers n (0<n<20000), m (0<m<50000) and c(0<=c<=n-1) meaning the number of the computers including wyh¡¯s, the number of those computers connect directly and the number of anti-wyhs. The second line contains c+1 integers. The first integer is the ID number of wyh¡¯s computer. The following integers are the ID numbers of anti-wyhs. The ID number is numbered from 0 to n-1. Then m lines follow. Each line contain two integers x, y. This means that the computer x and y are connected directly.

Note, if computer x connects to computer y, computer y also can connect to computer x.
 

Output
For each case, please output the number of the computers which have been attacked.
 

Sample Input
1 4 3 2 0 2 3 0 1 0 2 1 2
 

Sample Output
0
 

Author
Water Problem SecKill Expert
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 20:57:54, Gzip enabled