2016年3月10日

bzoj 2141 : 排队 分块

摘要: 题目链接 2141: 排队 Time Limit: 4 Sec Memory Limit: 259 MBSubmit: 1169 Solved: 465[Submit][Status][Discuss] Description 排排坐,吃果果,生果甜嗦嗦,大家笑呵呵。你一个,我一个,大的分给你,小的 阅读全文

posted @ 2016-03-10 20:28 yohaha 阅读(215) 评论(0) 推荐(0) 编辑

hdu 4162 Shape Number 最小表示法

摘要: 题目链接 给一个字符串, 将它想象成一个环, 然后从环中任意一个位置断开, 求断开后字典序最小的那种情况。 直接上模板.. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <alg 阅读全文

posted @ 2016-03-10 18:34 yohaha 阅读(211) 评论(0) 推荐(0) 编辑

codeforces 416B. Appleman and Tree 树形dp

摘要: 题目链接 Fill a DP table such as the following bottom-up: DP[v][0] = the number of ways that the subtree rooted at vertex v has no black vertex. DP[v][1] 阅读全文

posted @ 2016-03-10 17:53 yohaha 阅读(247) 评论(0) 推荐(0) 编辑

codeforces 167B . Wizards and Huge Prize 概率dp

摘要: 题目链接 dp[i][j][k]表示到第i个人赢了j个人剩余背包容量为k的情况。 然后转移就可以了。 #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #in 阅读全文

posted @ 2016-03-10 16:11 yohaha 阅读(332) 评论(0) 推荐(0) 编辑

codeforces 617E. XOR and Favorite Number 莫队

摘要: 题目链接 给n个数, m个询问, 每次询问问你[l, r]区间内有多少对(i, j), 使得a[i]^a[i+1]^......^a[j]结果为k。 维护一个前缀异或值就可以了。 要注意的是 区间[l, r], 我们需要将pre[l-1]......pre[r]都加进去, pre[l-1]不能少。 阅读全文

posted @ 2016-03-10 09:40 yohaha 阅读(291) 评论(0) 推荐(0) 编辑

导航