摘要: Problem Description有n对夫妻被邀请参加一个聚会,因为场地的问题,每对夫妻中只有1人可以列席。在2n 个人中,某些人之间有着很大的矛盾(当然夫妻之间是没有矛盾的),有矛盾的2个人是不会同时出现在聚会上的。有没有可能会有n 个人同时列席?Inputn: 表示有n对夫妻被邀请 (n 2 #include 3 using namespace std; 4 5 const int MAXN = 4010; 6 const int MAXM = 1010*1010*3; 7 8 struct TwoSAT{ 9 int n, ecnt;10 bool mark[M... 阅读全文
posted @ 2013-07-07 20:25 Oyking 阅读(429) 评论(0) 推荐(0) 编辑
摘要: Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet — it calculates the maximum flow in an undirected graph. The graph consists ofnvertices andmedges. Vertices are numbered from 1 ton. Vertices1andnbeing the source and the sink respectively.How 阅读全文
posted @ 2013-07-06 20:12 Oyking 阅读(537) 评论(0) 推荐(0) 编辑
摘要: You have been givenndistinct integersa1, a2, ..., an. You can remove at mostkof them. Find the minimum modularm(m > 0), so that for every pair of the remaining integers(ai, aj), the following unequality holds:.InputThe first line contains two integersnandk(1 ≤ n ≤ 5000, 0 ≤ k ≤ 4), which we have 阅读全文
posted @ 2013-07-06 00:04 Oyking 阅读(372) 评论(0) 推荐(0) 编辑
摘要: ————————————————————————这些是转的,出处不明———————————————————————————————树状数组比较适合单个元素改变,反复求部分和,或者区间更新,单点求值。 先看的是一维的树状数组。 树状数组是一个很天才的想法,考虑这样的一种情景,对于一组数据,你经常要求他... 阅读全文
posted @ 2013-06-20 20:50 Oyking 阅读(1360) 评论(1) 推荐(0) 编辑
摘要: Smart Beaver is careful about his appearance and pays special attention to shoes so he has a huge number of pairs of shoes from the most famous brands of the forest. He's trying to handle his shoes carefully so that each pair stood side by side. But by the end of the week because of his very act 阅读全文
posted @ 2013-06-14 19:52 Oyking 阅读(510) 评论(0) 推荐(0) 编辑
摘要: Sereja has a sequence that consists ofnpositive integers,a1, a2, ..., an.First Sereja took a piece of squared paper and wrote alldistinctnon-empty non-decreasing subsequences of sequencea. Then for each sequence written on the squared paper, Sereja wrote on a piece of lines paper all sequences thatd 阅读全文
posted @ 2013-06-12 15:16 Oyking 阅读(553) 评论(0) 推荐(0) 编辑
摘要: 转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html//原版为pascal代码,C++代码是我自己写的,写得不好敬请见谅【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变 阅读全文
posted @ 2013-06-04 16:51 Oyking 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变形,还有求和sigma。【定义】01分数规划问题:所谓的01分数规划 阅读全文
posted @ 2013-06-04 10:54 Oyking 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 bool isPrime[1000000]; 6 int prime[1000000]; 7 int MAX, total, cnt; 8 ... 阅读全文
posted @ 2013-06-04 10:47 Oyking 阅读(414) 评论(0) 推荐(0) 编辑
摘要: ProblemDescriptionBandBandRockisquitesensitivewithnumbers(anumberisdefinedasasequenceformedby‘0’-‘9’).Hethinksthislistofluckynumberscanbringhimluck(forexamplehisluckylistcouldbe9,13)andhelovesthesenumbersverymuch!Oneday,BandBandRockischoosingapasswordforhisbankaccount(apasswordisasequenceformedby‘0’ 阅读全文
posted @ 2013-06-04 10:45 Oyking 阅读(1142) 评论(0) 推荐(0) 编辑