A Road Problem

View as PDF

Submit solution

Points: 12
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types

jsumabat is going to be late for school! However, this time, it's not his fault. Ninjaclasher is trying to stop him from making it on time for his test, and as such, will close down \(Q\) intersections in total (jsumabat cannot enter closed intersections). The city of Toronto has a total of \(N\) intersections, with a total of \(M\) roads between them.

He starts at intersection \(1\), and the school is at intersection \(N\).

For every intersection Ninjaclasher closes down, if jsumabat can still get to school, print YES, otherwise print NO.

It is guaranteed that initially, he can visit all the intersections.

Note that intersections are not roads.

Input Specifications

The first line of input will contain the integer \(N\) \((3 \le N \le 10^5)\), \(M\) \((N-1 \le M \le 2 \times 10^5)\) and \(Q\) \((1 \le Q \le 10^5)\), followed by \(M\) pairs of integers a b, meaning that there is a bidirectional road between \(a\) and \(b\).

There will then be \(Q\) integers \(v\), meaning that the \(v^{th}\) intersection has been blocked off. Note that \(v\) is not distinct.

Queries are persistent.

Output Specifications

Output YES or NO for each query.

Sample Input

3 3 2
1 2
2 3
1 3
2
3

Sample Output

YES
NO

Comments

There are no comments at the moment.