06 2013 档案
摘要:————————————————————————这些是转的,出处不明———————————————————————————————树状数组比较适合单个元素改变,反复求部分和,或者区间更新,单点求值。 先看的是一维的树状数组。 树状数组是一个很天才的想法,考虑这样的一种情景,对于一组数据,你经常要求他...
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html//原版为pascal代码,C++代码是我自己写的,写得不好敬请见谅【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变
阅读全文
摘要:转自http://www.cnblogs.com/perseawe/archive/2012/05/03/01fsgh.html【关键字】0/1分数规划、最优比率生成树、最优比率环【背景】根据楼教主的回忆录,他曾经在某一场比赛中秒掉了一道最优比率生成树问题,导致很多人跟风失败,最终悲剧。自己总结了一些这种问题的解法,因为水平有限,如果有错误或是麻烦的地方,尽管喷,邮箱或是下方留言。联系我的话perseawe@163.com,欢迎讨论,请在标题前注明[acm]或是[oi],以免被垃圾邮件。【知识储备】只会用到简单的公式的整理与变形,还有求和sigma。【定义】01分数规划问题:所谓的01分数规划
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 5 bool isPrime[1000000]; 6 int prime[1000000]; 7 int MAX, total, cnt; 8 ...
阅读全文
摘要:ProblemDescriptionBandBandRockisquitesensitivewithnumbers(anumberisdefinedasasequenceformedby‘0’-‘9’).Hethinksthislistofluckynumberscanbringhimluck(forexamplehisluckylistcouldbe9,13)andhelovesthesenumbersverymuch!Oneday,BandBandRockischoosingapasswordforhisbankaccount(apasswordisasequenceformedby‘0’
阅读全文
摘要:DescriptionAliceandBobmeetagain.ThistimetheyplayagamenamedMATRIXTRANSFORMER.Theygotann*nboard.Everygridhastwopositions,UPandDOWN.Inthisgameyoucanpushsomeamazingbuttonstoexchangeanytworowsoranytwocolumns.AlicewillwinifshegotthegridsinthemaindiagonallineallUP.ButAlicefindsthatforsomeboard,nomatterhowm
阅读全文
摘要:ProblemDescription传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子在他们的经济范围内出一定的价格,比如有3间房子,一家老百姓可以对第一间出10万,对第2间出2万,对第3间出20万.(当然是在他们的经济范围内).现在这个问题就是村领导怎样分配房子才能
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3618ProblemDescriptionFJhastwosamehousesforrant.Nowhehasn(1≤n≤1000)pieceoforder,theordersaregiveninthef...
阅读全文
摘要:ProblemDescriptionAgroupofthievesisapproachingamuseuminthecountryofzjsxzy,nowtheyareincityA,andthemuseumisincityB,wherekeepsmanybrokenlegsofzjsxzy.Luckily,GWlearnedtheconspiracywhenheiswatchingstarsandtoldittozjsxzy.Zjsxzydecidedtocaughtthesethieves,andheletthepolicetodothis,thepolicetrytocatchthemo
阅读全文
摘要:在二分图中,最大匹配数 = 最大流 = 最小割 = 最小点集覆盖 = 总点数 - 最大独立集 Knig定理的证明:(还是matrix67讲得清楚:http://www.matrix67.com/blog/archives/116) 假如我们已经通过匈牙利算法求出了最大匹配(假设它等于M),下面给出的
阅读全文
摘要:Arobothasbeensenttoexplorearemoteplanet.Tospecifythepaththerobotshouldtake,aprogramissenteachday.Theprogramconsistsofasequenceofthefollowingcommands:F...
阅读全文
摘要:DescriptionInacity,busisthemostpopularvehicleforcitizenstogofromoneplacetoanother.Unfortunately,sometimesonepersoncannottravelfromonebusstationtoanotherdirectly,becausethereisnobuslinethroughthesetwostations.Sohehadtogotoamedialstationfromthestartingstation,thenchangestoabuswhichgofromthisintermedia
阅读全文
摘要:DescriptionArectangleisspecifiedbyapairofcoordinates(x1,y1)and(x2,y2)indicatingitslower-leftandupper-rightcorners(x1 #include #include #include ...
阅读全文
摘要:D.ColorfulGraphtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYou'vegotanundirectedgraph,consistingofnverticesandmedges.Wewillconsiderthegraph'sverticesnumberedwithintegersfrom1ton.Eachvertexofthegraphhasacolor.Thecolorofthei-thvertexisanintegerci
阅读全文
摘要:DescriptionAlicehasapianowhichcanplaysnicemusic,butit'sdifferentfromotherpianos.Ithastworowsofkeys,andthemethodofplayingitisalsoquitespecial.WhenAlice...
阅读全文

浙公网安备 33010602011771号