#P8860. Dynamic Edge Deletion in a Directed Graph
Dynamic Edge Deletion in a Directed Graph
Dynamic Edge Deletion in a Directed Graph
You are given a directed graph with \(n\) nodes and \(m\) edges. Initially, there is at least one path from node \(1\) to node \(n\). You are then given \(q\) queries. In each query, you are provided with a positive integer \(x\) (\(1 \le x \le m\)).
For each query, if the \(x\)th edge (as given in the input order) has not already been removed and its removal maintains at least one path from \(1\) to \(n\), then remove that edge permanently from the graph. Otherwise, do nothing. Print YES if the edge is removed for that query, and NO otherwise.
Note: Once an edge is removed in any query, it will remain removed for all future queries.
inputFormat
The input begins with a line containing three space-separated integers \(n\), \(m\), and \(q\) (the number of nodes, edges, and queries respectively).
The next \(m\) lines each contain two integers \(u\) and \(v\), representing a directed edge from \(u\) to \(v\). The edges are numbered from \(1\) to \(m\) in the order they are given, and it is guaranteed that initially there is a path from \(1\) to \(n\).
The following \(q\) lines each contain a single integer \(x\), indicating that for that query you should consider removal of the \(x\)th edge.
outputFormat
For each query, output a single line containing YES if the edge is removed, or NO otherwise.
sample
4 4 5
1 2
2 3
3 4
2 4
2
3
1
4
2
YES
YES
NO
YES
NO
</p>