#P2944. [USACO09MAR] Earthquake Damage 2 G

    ID: 1985 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2009USACO网络流图的建立,建图最小割

[USACO09MAR] Earthquake Damage 2 G

Description

Wisconsin has had an earthquake that has struck Farmer John's farm! The earthquake has damaged some of the pastures so that they are unpassable. Remarkably, none of the cowpaths was damaged.

As usual, the farm is modeled as a set of P (1P3,000)P\ (1 \le P \le 3,000) pastures conveniently numbered 1P1\cdots P which are connected by a set of C (1C20,000)C\ (1 \le C \le 20,000) non-directional cowpaths conveniently numbered 1C1\dots C. Cowpath ii connects pastures aia_i and bi (1ai,biP)b_i\ (1 \le a_i,b_i \le P). Cowpaths might connect aia_i to itself or perhaps might connect two pastures more than once. The barn is located in pasture 11.

A total of N (1NP)N\ (1 \le N \le P) cows (in different pastures) sequentially contacts Farmer John via moobile phone with an integer message reportj (2reportjP)report_j\ (2 \le report_j \le P) that indicates that pasture reportjreport_j is undamaged but that the calling cow is unable to return to the barn from pasture reportjreport_j because she could not find a path that does not go through damaged pastures.

After all the cows report in, determine the minimum number of pastures that are damaged.

Input Format

Line 11: Three space-separated integers: PP, CC, and NN.

Lines 2C+12\dots C+1: Line i+1i+1 describes cowpath ii with two integers: aia_i and bib_i.

Lines C+2C+N+1C+2\dots C+N+1: Line C+1+jC+1+j contains a single integer: reportjreport_j

Output Format

Line 11: One number, the minimum number of damaged pastures.

5 5 2 
1 2 
2 3 
3 5 
2 4 
4 5 
4 
5 

1 

Hint

Only pasture 22 being damaged gives such a scenario.