#P15728. [JAG 2023 Summer Camp #3] Odd trip plans
[JAG 2023 Summer Camp #3] Odd trip plans
题目描述
JAG is a country with airports numbered through to . There are some airways, each of which connects two different airports bidirectionally. In other words, if an airway connects airports and , a passenger can move either from to or from to in a single flight. Airways may be newly established or abolished.
Mr. Oddytrip, who is a traveler loving odd numbers, plans a trip from an airport to another one by flights. Let's say that he boards flights: A flight from airport to , then from to , then from to , and so on, and finally from to . This trip plan, which begins with and ends with , is written as $p_1 \rightarrow p_2 \rightarrow p_3 \rightarrow p_4 \rightarrow \cdots \rightarrow p_k \rightarrow p_{k+1}$. According to his aesthetics, a trip plan is beautiful if each of airports appears an odd number of times in the trip plan. For example, if , trip plans $3 \rightarrow 4 \rightarrow 5 \rightarrow 6 \rightarrow 1 \rightarrow 2$ and $1 \rightarrow 2 \rightarrow 3 \rightarrow 4 \rightarrow 5 \rightarrow 3 \rightarrow 2 \rightarrow 3 \rightarrow 2 \rightarrow 6$ are beautiful while and $1 \rightarrow 2 \rightarrow 3 \rightarrow 4 \rightarrow 1 \rightarrow 5 \rightarrow 6$ aren't. In particular, each of the airports appears at least one in a beautiful trip plan.
Initially, there are airways. Then, you are given queries, which should be processed in the order they are given. Each query is of one of the two kinds below:
- : The existence of the airway between airports and changes. If there is already an airway between airports and , then such an airway is abolished. In other words, Mr. Oddytrip is no longer able to board the direct flight between airports and (until it is newly established again). On the other hand, if there wasn't such an airway before, an airway between airports and is newly established. In other words, Mr. Oddytrip can board a direct flight between airports and (until it is abolished again).
- : You have to determine whether there can be a beautiful trip plan which begins with airport and ends with airport using the airways which are available at that time.
输入格式
The input consists of a single test case of the following format.
$$\begin{aligned} &n \ m \ q \\ &u_1 \ v_1 \\ &\vdots \\ &u_m \ v_m \\ &t_1 \ x_1 \ y_1 \\ &\vdots \\ &t_q \ x_q \ y_q \end{aligned} $$The first line consists of three integers , and (, , ), where is the number of airports in JAG country, is the number of airways which are initially available, and is the number of queries.
The -th of the following lines consists of two integers and () representing that an airway between airports and is initially available. It is guaranteed that these airways are distinct.
The -th of the following lines consists of three integers , and (, ) representing the type of the query and the numbers of two airports as described above. It is guaranteed that there is at least one query where .
输出格式
For each query where , print "Yes" in a single line if there can be a beautiful trip plan which begins with airport and ends with airport . Otherwise, print "No" in a single line.
4 2 6
1 2
3 4
2 1 2
1 2 3
2 1 2
1 2 4
1 2 3
2 1 3
No
Yes
Yes
5 5 4
1 2
2 3
3 4
1 4
4 5
2 1 3
2 1 4
1 2 4
2 1 4
Yes
No
Yes