难得的ZJOI水题...DFS一遍就行了... ----------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<cctype> using namespace std; const int maxn = 500009; int N = 0,
题目:https://www.luogu.org/problemnew/show/P2585 首先,三色其实记录两种状态:是绿色,不是绿色 即可,因为红蓝可以随意取反: 一开始因为懒得还原出树,所以写了个错误贪心-_- #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int k,mx,mn,siz[maxn]; c