摘要: dp[i]=min(dp[j]+(sum[i]-sum[j]+i-j-1-L)^2) (j<i) 令f[i]=sum[i]+i,c=1+l 则dp[i]=min(dp[j]+(f[i]-f[j]-c)^2) 1.证明决策单调性 假设在状态i处的k决策优与j决策,即 dp[k]+(f[i]-f[k]- 阅读全文
posted @ 2017-02-28 19:56 free-loop 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 正着不好搞,考虑倒着搞。倒着搞就是一个并查集。 # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include 阅读全文
posted @ 2017-02-28 19:44 free-loop 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 有一种东西叫树的prufer序列,一个树的与一个prufer序列是一一对应的关系。 设有m个度数确定的点,这些点的度为dee[i],那么每个点在prufer序列中出现了dee[i]-1次。 由排列组合可以推出公式。需要用高精度。 #include<cstdio> #include<cstring> 阅读全文
posted @ 2017-02-28 18:16 free-loop 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 因为有着色数的限制,故使用Burnside引理。 添加一个元置换(1,2,,,n)形成m+1种置换,对于每个置换求出循环节的个数, 每个循环节的长度。 则ans=sigma(f(i))/(m+1) %p (1<=i<=m+1). 其中f(i)是第i种置换下的不动点个数。 可以用dp来求出f(i), 阅读全文
posted @ 2017-02-28 17:20 free-loop 阅读(179) 评论(0) 推荐(0) 编辑