
Pashmak'shomeworkisaproblemaboutgraphs.Althoughhealwaystriestodohishomeworkcompletely,hecan'tsolvethisproblem.Asyouknow,he'sreallyweakatgraphtheory;sotrytohelphiminsolvingtheproblem.Youaregivenaweighteddirectedgraphwith n verticesand m edges.Youneedtofindapath(perhaps,non-simple)withmaximumnumberofedges,suchthattheweightsoftheedgesincreasealongthepath.Inotherwords,eachedgeofthepathmustha...

Alexdoesn'tlikeboredom.That'swhywheneverhegetsbored,hecomesupwithgames.Onelongwintereveninghecameupwithagameanddecidedtoplayit.Givenasequence a consistingof n integers.Theplayercanmakeseveralsteps.Inasinglestephecanchooseanelementofthesequence(let'sdenoteit ak)anddeleteit,atthatallelementsequalto ak + 1 and ak - 1 alsomustbedeletedfromthesequence.Thatstepbrings ak pointstothe...

PrincessTwilightwenttoCelestiaandLuna'soldcastletoresearchthechestfromtheElementsofHarmony.Asequenceofpositiveintegers bi isharmonyifandonlyifforeverytwoelementsofthesequencetheirgreatestcommondivisorequals1.Accordingtoanancientbook,thekeyofthechestisaharmonysequence bi whichminimizesthefollowingexpression:Youaregivensequence ai,helpPrincessTwilighttofindthekey.InputThefirstlinec...
![「BZOJ2101」[Usaco2010 Dec] Treasure Chest 藏宝箱](http://hzwer.com/wp-content/themes/ly/image/image_post/2014-12-10_12-59-38.jpg)
DescriptionBessieandBonniehavefoundatreasurechestfullofmarvelousgoldcoins!Beingcows,though,theycan'tjustwalkintoastoreandbuystuff,soinsteadtheydecidetohavesomefunwiththecoins.TheN(1<=N<=5,000)coins,eachwithsomevalueC_i(1<=C_i<=5,000)areplacedinastraightline.BessieandBonnietaketurns,andforeachcow'sturn,shetakesexactlyonecoinoffofeithertheleftendortherightendoftheline.Thegame...
![「BZOJ1672」[Usaco2005 Dec] Cleaning Shifts 清理牛棚](http://hzwer.com/wp-content/themes/ly/image/image_post/2014-12-10_11-18-46.jpg)
DescriptionFarmerJohn'scows,pamperedsincebirth,havereachednewheightsoffastidiousness.Theynowrequiretheirbarntobeimmaculate.FarmerJohn,themostobligingoffarmers,hasnochoicebuthiresomeofthecowstocleanthebarn.FarmerJohnhasN(1<=N<=10,000)cowswhoarewillingtodosomecleaning.Becausedustfallscontinuously,thecowsrequirethatthefarmbecontinuouslycleanedduringtheworkday,whichrunsfromsecondnumbe...
![「BZOJ1664」[Usaco2006 Open] County Fair Events 参加节日庆祝](http://hzwer.com/wp-content/themes/ly/image/image_post/2014-12-10_11-16-16.jpg)
DescriptionFarmerJohnhasreturnedtotheCountyFairsohecanattendthespecialevents(concerts,rodeos,cookingshows,etc.).HewantstoattendasmanyoftheN(1<=N<=10,000)specialeventsashepossiblycan.He'srentedabicyclesohecanspeedfromoneeventtothenextinabsolutelynotimeatall(0timeunitstogofromoneeventtothenext!).GivenalistoftheeventsthatFJmightwishtoattend,withtheirstarttimes(1<=T<=100,000)a...

Youhave k piecesoflaundry,eachofwhichyouwanttowash,dryandfold.Youareatalaundromatthathas n1 washingmachines,n2 dryingmachinesand n3 foldingmachines.Eachmachinecanprocessonlyonepieceoflaundryatatime.Youcan'tdryapieceoflaundrybeforeitiswashed,andyoucan'tfolditbeforeitisdried.Moreover,afterapieceoflaundryiswashed,itneedstobeimmediatelymovedintoadryingmachine,andafteritisdried,itneedstobei...
近期评论