HihoCoder - 1387 求树上相同颜色的直径
题目: 给你一棵n个节点的树,每个节点的颜色可能不同,现在要给你两种颜色,问你两种颜色的最大距离。如果有一种颜色不存在那么直接输出-1 即可。
#include<bits/stdc++.h>
using namespace std;
const int inf=99999999;
const int maxn=1e5+10;
int n,m,a[maxn];
struct no...
原创
2018-09-13 14:44:08 ·
239 阅读 ·
0 评论