上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 83 下一页
摘要: 四边形不等式优化 填坑 简介 在动态规划问题中 我们常遇到这样一类问题,它的dp方程长这样 $$f[i][j] = min \{ f[i][k] + f[k + 1][j]+cost[i][j] \} $$ 这样我们的复杂度一般是$O(n^3)$的 设$a =w(b,c)$则称w关于区间包含关系单调 阅读全文
posted @ 2018-05-06 16:09 zzzzx 阅读(385) 评论(0) 推荐(1) 编辑
摘要: 题目链接 "bzoj2428: [HAOI2006]均分数据" 题解 模拟退火即可 代码 c++ include include include include const int maxn = 100007; int a[maxn]; double avr,tmpans,ans = 2515656 阅读全文
posted @ 2018-05-06 14:44 zzzzx 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj3680: 吊打XXX" 题解 物理题 问题转化为求力的重心 模拟退火即可 代码 c++ include include include include const int maxn = 100007; double x[maxn],y[maxn],w[maxn]; int n; 阅读全文
posted @ 2018-05-06 14:42 zzzzx 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 留个坑 挺套路的 明天来写个总结 c++ include include inline int read() { int x = 0,f = 1; char c = getchar(); while(c '9') {if(c == ' ') f = 1;c = getchar();} while(c 阅读全文
posted @ 2018-05-05 21:51 zzzzx 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj2809: [Apio2012]dispatching" 题解 领导关系形成一棵树,那么答案为$ans=max{L[u]\times k}$,其中k代表以u为根的子树中选出的节点数个数(设这些节点为$v_1,v_2\cdots v_k$且有$\sum_{i=1}^{k}C[v_i 阅读全文
posted @ 2018-05-05 21:47 zzzzx 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 学了下km算法.... 写了道题 然后一遍过了2333 c++ include include include using namespace std; define INF 0x3f3f3f3f const int maxn = 1007; int kind[maxn][maxn]; int ma 阅读全文
posted @ 2018-05-05 21:40 zzzzx 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题解 跳出序构成一颗一n +1为根的树 你需要支持cut,link,以及查询子树大小的操作 lct随便打...... 话说之前是用块状链表水的.... 代码 阅读全文
posted @ 2018-05-02 22:06 zzzzx 阅读(122) 评论(0) 推荐(0) 编辑
摘要: solution 被假hash可了半天....sadQAQ code c++ // luogu judger enable o2 include include include include inline int read() { int x = 0,f = 1; char c = getchar 阅读全文
posted @ 2018-05-02 22:03 zzzzx 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj1096: [ZJOI2007]仓库建设" 题解 emmmm,dp转移前缀和的构造方法不是和上一个题是一模一样的吗 不对,这不就是和上一个题一样吗,只是转移方程把i换成了x[i].... 详见 "bzoj3437: 小P的牧场" 瞎jb写写就过了 tut 代码 c++ inclu 阅读全文
posted @ 2018-05-02 20:46 zzzzx 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj3437: 小P的牧场" 题解 dp转移有点玄学....好神的前缀和呀quq可能当时做时心态不太好 ?QAQ 令$$sum[i]=\sum_{k=1}^{i}b[k],cost[i]=\sum_{k=1}^{i}\{b[k] k\}$$ 得出dp方程 $$dp[i]=\min_{ 阅读全文
posted @ 2018-05-02 20:02 zzzzx 阅读(130) 评论(0) 推荐(0) 编辑
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 83 下一页