摘要:
D:题意:树上每个顶点有个权值,求最长链,满足链上gcd > 1 解:对每个质数建虚树,每个点只会拆成log个点,所以是log2的。 1 #include <bits/stdc++.h> 2 3 const int N = 200010; 4 5 struct Edge { 6 int nex, v 阅读全文
摘要:
我也不知道哪里蒯来的题。反正二分 + 2-sat + 线段树优化连边就完事了。 注意答案可能为0.. 1 #include <bits/stdc++.h> 2 3 const int N = 100010; 4 5 struct Edge { 6 int nex, v; 7 }edge[300001 阅读全文