Cut Vertex
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
You are given an undirected graph. For each query, determine whether the given vertex is an articulation point in the graph.
An articulation point is a vertex whose removal (along with all incident edges) increases the number of connected components of the graph.
Input
- The first line contains three integers n, m, q - the number of vertices and the number of queries (1 ≤ n ≤ 5x10^4, 1 ≤ m ≤ 2 x 10^5, q ≤ 300).
- The following m lines each contain two integers u, v (1 ≤ u, v ≤ n) representing an undirected edge between vertices u and v.
The next q lines each contain a single integer x — the vertex to check.
Output
Print q lines.
- For each query, output YES if the vertex is an articulation point, otherwise output NO.
Example
Input
5 5 3
1 2
2 3
2 4
4 5
3 5
2
3
4
Output
YES
NO
NO
Bình luận