OkazakiYumemi / okazakiyumemi.github.io

Maybe just a blog
https://okazakiyumemi.github.io/
0 stars 0 forks source link

「AGC029F」Construction of a tree | Okazaki Yumemi's blog #162

Open OkazakiYumemi opened 3 years ago

OkazakiYumemi commented 3 years ago

https://okazakiyumemi.github.io/blog/AGC029F/

题意简述[AGC 029F] 一张无向图有 $n$ 个点,还没有边。给出 $n - 1$ 个大小至少为 $2$ 的点集 $E_i$ ,问是否能从每个点集中选出两个点连边,使得图连边后为一棵树。若能,输出一种方案;若否,输出 -1 。$2\le n\le 10^5, \sum|E_i|\le 2\times 10^5$ 。