一名苦逼的OIer,想成为ACMer

Iowa_Battleship

2018年11月3日

洛谷1726 上白泽慧音

摘要: "原题链接" 裸的$tarjan$找强连通分量,记录最大强连通分量即可,注意字典序。 cpp include using namespace std; const int N = 5010; const int M = 1e5 + 10; int fi[N], di[M], ne[M], dfn[N 阅读全文

posted @ 2018-11-03 11:03 Iowa_Battleship 阅读(98) 评论(0) 推荐(0) 编辑

洛谷1268 树的重量

摘要: "原题链接" 当$n = 2$时,显然答案为$M(1, 2)$ 当$n = 3$时,我们固定$M(1, 2)$,考虑$3$的位置。 如图,$3$的位置肯定是从$(1,2)$中分支出来的,所以答案为$M(1, 2) + \dfrac{M(1, 3) + M(2, 3) M(1, 2)}{2}$。 于是 阅读全文

posted @ 2018-11-03 10:13 Iowa_Battleship 阅读(118) 评论(0) 推荐(0) 编辑

导航