随笔分类 - 树型dp
摘要:problemsolutioncodes//树形DP//f[u]:割掉u和u子树中所有的叶子节点所需要的最小代价#include#includeusing namespace std;typedef long long LL;const int N = (int)1e...
阅读全文
摘要:problemsolutioncodes//vijos 1180#include#includeusing namespace std;struct Edge { int w; vectorto; }G[1010];int f[1010][1010];//dfs(x...
阅读全文
摘要:problemsolutioncodes/*用f[x][0],f[x][1] 分别表示x没去和去了的最大价值。f[x][0] = sigmar:max(f[y][0],f[y][1]);f[x][1] = sigmar:f[y][0];*/#include#inclu...
阅读全文
摘要:problemsolutioncodes//f[i,j]表示用j秒回到i最多拿几幅画//链式建树#include#includeusing namespace std;const int maxn = 1010;int tot, n(1), f[maxn][maxn]...
阅读全文