#C1985. Minimum Reporting Checkpoints

    ID: 45250 Type: Default 1000ms 256MiB

Minimum Reporting Checkpoints

Minimum Reporting Checkpoints

You are given a graph with n camping sites modeled as nodes and m trails modeled as weighted undirected edges. There are e designated exit points. For each camping site, the reporting checkpoint is defined by its minimum distance to any exit point. Your task is to compute the number of unique minimum distances for all camping sites.

The relationship between the distance d from a site to the nearest exit and the reporting system is given by the formula:

di=minxExits  dist(i,x)d_i = \min_{x \in Exits} \; \text{dist}(i, x)

The answer is the size of the set \( \{ d_i : 0 \le i < n \}\).

inputFormat

The first line contains three integers \(n\), \(m\), and \(e\) where \(n\) is the number of camping sites, \(m\) is the number of trails, and \(e\) is the number of exit points.

The second line contains \(e\) space-separated integers representing the exit points.

Each of the next \(m\) lines contains three integers \(u\), \(v\), and \(w\) denoting a trail between sites \(u\) and \(v\) with weight \(w\).

outputFormat

Output a single integer representing the minimum number of reporting checkpoints required. This integer is equal to the number of unique minimum distances from every camping site to its nearest exit point.

## sample
5 6 3
2 3 4
0 1 2
0 2 3
1 3 2
2 3 1
2 4 2
3 4 1
3