上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 48 下一页
  2012年11月28日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1069建树呀 水题代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map>#include<string>#include<queue>#include<stack 阅读全文
posted @ 2012-11-28 09:17 夜-> 阅读(170) 评论(0) 推荐(0) 编辑
  2012年11月27日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1182比较麻烦的一道题先将不是相互知道的两个人重新建边 A知道B 但B不知道A 也需要建边(双向边)新的图是m个连同块 对于每个连同块 用bfs将他们分成两组 组1 和组2 如果分的过程中出现矛盾 则无解否则就会有m对 然后根据这m对 用DP的思想求最优解 既可代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm&g 阅读全文
posted @ 2012-11-27 19:58 夜-> 阅读(234) 评论(0) 推荐(0) 编辑
  2012年11月23日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1162被这句话害了 "Let us call some sequence of the exchange operations simple if no exchange point is used more than once in this sequence."根本没有意义 直径 spfa 就行代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math 阅读全文
posted @ 2012-11-23 18:23 夜-> 阅读(339) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1056求树的圆心两遍 bfs 找到直径 然后圆心有一个或两个代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map>#include<string>#include<queue 阅读全文
posted @ 2012-11-23 10:28 夜-> 阅读(193) 评论(0) 推荐(0) 编辑
  2012年11月22日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1721左边:rank 3,4,7,8,11,12.........右边:rank 5,6,9,10,13,14.........然后匈牙利算法代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map&g 阅读全文
posted @ 2012-11-22 20:48 夜-> 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1643bfs 就可以 不过要注意细节思路:分别求出 ‘!’到每个点的最短路 dist1 ,‘$’到每个点的最短路 dist2 和 ‘*’到每个点的最短路 dist3然后枚举每个点 的 max(dist1+dist2)+dist3 值 求最小代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include& 阅读全文
posted @ 2012-11-22 17:27 夜-> 阅读(307) 评论(0) 推荐(0) 编辑
  2012年11月21日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1145两次bfs 找树的直径 还有在函数里面不能定义太大的数组 否则执行不了代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map>#include<string>#include& 阅读全文
posted @ 2012-11-21 10:39 夜-> 阅读(209) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/245/problem/H代码及其注释:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map>#include<string>#include<queue>#include<stack>#include 阅读全文
posted @ 2012-11-21 08:24 夜-> 阅读(198) 评论(0) 推荐(0) 编辑
  2012年11月20日
摘要: http://codeforces.com/contest/245/problem/E枚举任意段内 ‘+’个数和‘-’个数的差(绝对值) 取最大可以 O(n^2)代码:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<vector>#include<set>#include<map>#include<string>#include<queu 阅读全文
posted @ 2012-11-20 20:26 夜-> 阅读(159) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/245/problem/D和今年长春赛区的 第二题一样 2-sat 将每一个数的每一位作为一个点 要么是 1 要么是 02-sat 主要是代码长 比较繁琐 尤其是需要求结果的题目-----------不对劲呀 走在路上一想 这个题不用2—sat 就可以呀 晕 想多了 附加简单代码代码1:#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include 阅读全文
posted @ 2012-11-20 19:57 夜-> 阅读(152) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 48 下一页