上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 30 下一页
摘要: 这个题就是在dfs的过程中记录到根的前缀和,以及前缀和的最小值 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <sta 阅读全文
posted @ 2016-06-25 08:33 shuguangzw 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题意:给你一个森林,表示其祖先关系(自己也是自己的祖先),每个人有一个礼物(要送给这个人的固定的一个祖先) 让你构造一个序列,使得的对于每个人,这个序列中第一个出现的他的祖先,是他要送礼物的的那个祖先 分析:这个序列满足 1:我们这个序列只需要出现那些被送礼物的人就好了 2:这个序列的元素保证,如果 阅读全文
posted @ 2016-06-24 15:36 shuguangzw 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 奉上官方题解 然后直接写的记忆化搜索 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include 阅读全文
posted @ 2016-06-23 17:16 shuguangzw 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 这个题是个想法题 先预处理连通块,然后需要用到一种巧妙暴力,即0变1,1变0,一列列添加删除 复杂度O(n^3) #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #in 阅读全文
posted @ 2016-06-22 21:42 shuguangzw 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 矩阵快速幂的题要多做 由题可得 g[n]=A*g[n-1]+B 所以构造矩阵 { g[n] } = {A B} * { g[n-1]} { 1 } {0 1} { 1 } 然后矩阵快速幂就好 矩阵快速幂的题要多做,多构造矩阵 注:其实这个题可以直接等比数列求求和,单数矩阵快速幂对于这类题更具有普遍性 阅读全文
posted @ 2016-06-22 21:36 shuguangzw 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 第一次交互题,记录一下吧 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algor 阅读全文
posted @ 2016-06-19 21:03 shuguangzw 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 这个题一眼看上去不会 然后有人说是网络流 然后我就想怎么建图啊,然后不会(是本蒟蒻太垃圾了),肯定有网络流解法 然后去群里问了gdut的巨巨,他说他队友爆搜+剪枝过了(我也是非常的叹服) 然后我也写了一个2^50的搜索剪枝,居然真过了(不知道是数据弱还是大力出奇迹) #include <cstdio 阅读全文
posted @ 2016-06-18 21:29 shuguangzw 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 分析:开个1000*1000的数组,预处理矩阵和,然后分类讨论就好 时间复杂度:O(n) #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> 阅读全文
posted @ 2016-06-18 09:42 shuguangzw 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 分析:因为加起来不超过1e6,所以最多有1000+个不同的数 做法:离散化搞就好了 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #in 阅读全文
posted @ 2016-06-18 09:40 shuguangzw 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题意:挺好懂得 分析:先计算出如果不能用(减2)操作,至少需要多少个(减3)操作,这个很好计算 然后就是尽量多的去减少(减3)操作,肯定先抹平 余2 和 余1 的,然后就可以了 #include <cstdio> #include <iostream> #include <ctime> #inclu 阅读全文
posted @ 2016-06-16 10:37 shuguangzw 阅读(191) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 30 下一页