#P5787. 【模板】线段树分治 / 二分图
【模板】线段树分治 / 二分图
Description
Shenben has a graph with nodes.
Because Shenben is Shenben, within time , there will be edges that appear and then disappear.
Shenben asks you to determine whether the graph is a bipartite graph in each time period.
Such an easy problem is of course no problem for Shenben, so he wants to test you.
Originally BZOJ4025.
Input Format
The first line contains three integers .
In the next lines, each line contains four integers , meaning there is an edge connecting that appears at time and disappears at time .
Output Format
Output lines. The -th line contains a string Yes or No, indicating whether the graph is bipartite in the -th time period.
3 3 3
1 2 0 2
2 3 0 3
1 3 1 2
Yes
No
Yes
Hint
Sample Explanation
At time , two edges and appear.
In the st time period, this graph is bipartite, so output Yes.
At time , an edge appears.
In the nd time period, this graph is not bipartite, so output No.
At time , the two edges and disappear.
In the rd time period, there is only one edge , and this graph is bipartite, so output Yes.
Constraints
, . , .
Notes
This problem has hack testdata (Subtask ), worth points, but if you do not pass the hack testdata, it will not be considered accepted.
Translated by ChatGPT 5
京公网安备 11011102002149号