HBC216183比赛,深度优先搜索(DFS),枚举,搜索TreeConstructer题解

一沫阳光 算法基础篇 38 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
MianKing has a Graph Constructer : The input of it is a sequence a1...n(0≤ai

MianKing has a Graph Constructer : The input of it is a sequence a1...n (0≤ai<260)a_{1...n}~(0leq a_i<2^{60})a1...n​ (0≤ai​<260) and the output of it is an undirected graph with nnn nodes, edge (x,y)(x,y)(x,y) is in this graph if and only if (ax or ay)=260−1(a_x~or~a_y)=2^{60}-1(ax​ or ay​)=260−1 For example, if the input is a1...3={260−1,260−2,1}a_{1...3}={2^{60}-1,2^{60}-2,1}a1...3​={260−1,260−2,1}, the output is the graph {(1,1),(1,2),(1,3),(2,3)}{(1,1),(1,2),(1,3),(2,3)}{(1,1),(1,2),(1,3),(2,3)} Now GreenKing has a tree with nnn nodes, MianKing wants to find a sequence as input to get this tree. You need to help him find a sequence satisfy the condition.

HBC216183比赛,深度优先搜索(DFS),枚举,搜索TreeConstructer题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC216183比赛 深度优先搜索(DFS) 枚举 搜索TreeConstructer题解