#P6351. [PA 2011] Hard Choice
[PA 2011] Hard Choice
Description
There is an undirected graph with vertices and edges.
There are queries. Each query contains a character and two integers .
If is , it means a deletion operation: delete the edge . It is guaranteed that the edge has not been deleted before, but it is not guaranteed that the edge exists in the current graph (that is, it is possible to delete all edges).
If is , it means a query: ask whether there are two completely different paths between and . “Completely different” means the two paths do not share any edge, but they may share vertices.
Input Format
The first line contains three integers , with the same meaning as in the statement.
The next lines each contain two integers , indicating that there is an undirected edge between and .
The next lines each contain a character and two integers , with the same meaning as in the statement.
Output Format
For each query with equal to , if there exist two completely different paths, output one line with the string TAK. Otherwise, output one line with the string NIE.
7 8 7
1 2
1 3
1 4
2 3
3 4
3 7
7 4
5 6
Z 1 4
P 1 3
P 2 4
Z 1 3
P 1 3
Z 6 5
P 5 6
TAK
TAK
NIE
NIE
Hint
Constraints: , . It is guaranteed that the input is valid and there are no multiple edges or self-loops.
Translated by ChatGPT 5
京公网安备 11011102002149号