深究树形背包的时间复杂度

P1273 有线电视网

Orz
by VenusM1nT @ 2019-07-17 18:45:50


```cpp #include<bits/stdc++.h> using namespace std; int main() { //freopen("tt.in","w",stdout); int n=3000,m=2000; printf("%d %d\n",n,m); for(int i=1;i<=3000-2000;i++) printf("%d %d %d %d %d %d %d\n",3,1000+i,1,2000+i,1,i+1,1); for(int i=1;i<=m;i++)printf("%d ",3); return 0; } ```
by 7KByte @ 2019-07-17 18:47:03


@[hsfzLZH1](/space/show?uid=43486)
by 7KByte @ 2019-07-17 18:52:20


所以您怎么证明合并子树,相当于枚举任意两点,只会在它们的 LCA 处被枚举 **一次** 是错误的?
by hsfzLZH1 @ 2019-07-17 19:20:18


@[Gang_Leader](/space/show?uid=119261) 看了您的数据生成器,好像是 $3000$ 个点, $3000$ 条边?
by hsfzLZH1 @ 2019-07-17 19:23:10


@[Gang_Leader](/space/show?uid=119261) 您生成的图中有一个 $1-2-3-...-1000-1001-1$ 的环吧。。。
by hsfzLZH1 @ 2019-07-17 19:25:59


好吧多加了一条边
by 7KByte @ 2019-07-18 08:20:23


???
by 寒冰大大 @ 2019-10-05 15:27:28


树形背包显然是 $O(n^2)$ 的
by wucstdio @ 2019-10-05 15:28:32


|