[HackerRank University CodeSprint]Counting On a Tree
题目大意给定一棵nn个节点的树,每个节点有颜色cic_i。有qq个询问,每次给定(x,y,u,v)(x,y,u,v),询问有多少个点对(i,j)(i,j)满足
∙i≠j\bullet i\not=j
∙i∈path(x,y)\bullet i\in path(x,y)
∙j∈path(u,v)\bullet j\in path(u,v)
∙ci=cj\bullet c_i=c_j1≤n≤10
原创
2016-11-15 22:38:25 ·
786 阅读 ·
0 评论