摘要: 题目传送门 1 /* 2 题意:问最少替换'*'为'.',使得'.'连通的都是矩形 3 BFS:搜索想法很奇妙,先把'.'的入队,然后对于每个'.'八个方向寻找 4 在2*2的方格里,若只有一个是'*',那么它一定要被替换掉 5 */ 6 #include 7 #i... 阅读全文
posted @ 2015-05-27 21:48 Running_Time 阅读(159) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:查询x的id,每次前排的树倒下 3 使用lower_bound ()查找高度,f[i]记录第一棵高度为x树的位置,查询后+1(因为有序) 4 */ 5 #include 6 #include 7 #include 8 using namespac... 阅读全文
posted @ 2015-05-27 21:46 Running_Time 阅读(167) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:问值为x的个数有几个,第二次查询就是0 3 lower/upper_bound ()函数的使用,map也可过,hash方法不会 4 */ 5 #include 6 #include 7 #include 8 #include 9 #includ... 阅读全文
posted @ 2015-05-27 21:32 Running_Time 阅读(143) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:对于长度为x的子序列,每个序列存放为最小值,输出长度为x的子序列的最大值 3 set+线段树:线段树每个结点存放长度为rt的最大值,更新:先升序排序,逐个添加到set中 4 查找左右相邻的位置,更新长度为r - ... 阅读全文
posted @ 2015-05-27 18:55 Running_Time 阅读(173) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 3 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 4 详细解释:http://blog.csdn.net... 阅读全文
posted @ 2015-05-27 18:54 Running_Time 阅读(186) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const in... 阅读全文
posted @ 2015-05-27 18:53 Running_Time 阅读(144) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 字符串处理:回文串是串联的,一个一个判断 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 1e... 阅读全文
posted @ 2015-05-27 18:52 Running_Time 阅读(181) 评论(0) 推荐(0)