CF1559D2 Mocha and Diana (Hard Version)
题目描述
给你两棵森林,节点数均为 $n$。
允许你进行加边操作,但是有两个要求:
- 如果在第一个森林加一条 $(u,v)$ 的边,第二个森林也要进行同样的操作。反之同理。
- 加边后两个森林依旧是森林。(一棵树也是森林)
求最多能加几条边,并输出加边方案。
输入格式
无
输出格式
无
说明/提示
In the first example, we cannot add any edge.
In the second example, the initial forests are as follows.

We can add an edge $ (2, 4) $ .
