编程介的小学生 2017-11-05 16:18 采纳率: 20.5%
浏览 351
已结题

Security Center

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

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题