
KuriyamaMiraihaskilledmanymonstersandgotmany(namely n)stones.Shenumbersthestonesfrom 1 to n.Thecostofthe i-thstoneis vi.KuriyamaMiraiwantstoknowsomethingaboutthesestonessoshewillaskyoutwokindsofquestions:Shewilltellyoutwonumbers, l and r (1 ≤ l ≤ r ≤ n),andyoushouldtellher .Let ui bethecostofthe i-thcheapeststone(thecostthatwillbeonthe i-thplaceifwearrangealltheston...

Manystudentsliveinadormitory.Adormitoryisawholenewworldoffunnyamusementsandpossibilitiesbutitdoeshaveitsdrawbacks.Thereisonlyoneshowerandtherearemultiplestudentswhowishtohaveashowerinthemorning.That'swhyeverymorningthereisalineoffivepeopleinfrontofthedormitoryshowerdoor.Assoonastheshoweropens,thefirstpersonfromthelineenterstheshower.Afterawhilethefirstpersonleavestheshowerandthenextpersonent...

Quiterecently,averysmartstudentnamedJurydecidedthatlecturesareboring,sohedownloadedagamecalled"BlackSquare"onhissupercooltouchscreenphone.Inthisgame,thephone'sscreenisdividedintofourverticalstrips.Eachsecond,ablacksquareappearsonsomeofthestrips.Accordingtotherulesofthegame,Jurymustusethissecondtotouchthecorrespondingstriptomakethesquaregoaway.AsJuryisbothsmartandlazy,hecountedthathewaste...
![「BZOJ1755」[Usaco2005 qua] Bank Interest](http://hzwer.com/wp-content/themes/ly/image/image_post/2014-12-10_12-43-48.jpg)
DescriptionFarmerJohnmadeaprofitlastyear!Hewouldliketoinvestitwellbutwondershowmuchmoneyhewillmake.HeknowstheinterestrateR(anintegerbetween0and20)thatiscompoundedannuallyathisbank.HehasanintegeramountofmoneyMintherange100..1,000,000.HeknowshowmanyyearsY(range:0..400)heintendstoinvestthemoneyinthebank.Helphimlearnhowmuchmoneyhewillhaveinthefuturebycompoundingtheinterestforeachyearhesaves...

IahubistrainingfortheIOI.WhatisabetterwaytotrainthanplayingaZuma-likegame?Thereare n ballsputinarow.Eachballiscoloredinoneof k colors.Initiallytherowdoesn'tcontainthreeormorecontiguousballswiththesamecolor.Iahubhasasingleballofcolor x.Hecaninserthisballatanypositionintherow(probably,betweentwootherballs).Ifatanymomenttherearethreeormorecontiguousballsofthesamecolorintherow,theyare...

Thepolicedepartmentofyourcityhasjuststarteditsjourney.Initially,theydon’thaveanymanpower.So,theystartedhiringnewrecruitsingroups.Meanwhile,crimeskeepsoccurringwithinthecity.Onememberofthepoliceforcecaninvestigateonlyonecrimeduringhis/herlifetime.Ifthereisnopoliceofficerfree(isn'tbusywithcrime)duringtheoccurrenceofacrime,itwillgountreated.Giventhechronologicalorderofcrimeoccurrencesandrecru...

Pashahastwohamsters:ArthurandAlexander.Pashaput n applesinfrontofthem.PashaknowswhichapplesArthurlikes.Similarly,PashaknowswhichapplesAlexanderlikes.Pashadoesn'twantanyconflictbetweenthehamsters(astheymaylikethesameapple),sohedecidedtodistributetheapplesbetweenthehamstersonhisown.HeisgoingtogivesomeapplestoArthurandsomeapplestoAlexander.Itdoesn'tmatterhowmanyappleseachhamstergetsbu...

NearlyeachprojectoftheFcompanyhasawholeteamofdevelopersworkingonit.Theyoftenareindifferentroomsoftheofficeindifferentcitiesandevencountries.Tokeepintouchandtracktheresultsoftheproject,theFcompanyconductssharedonlinemeetingsinaSpykechat.OnedaythedirectoroftheFcompanygotholdoftherecordsofapartofanonlinemeetingofonesuccessfulteam.Thedirectorwatchedtherecordandwantedtotalktotheteamleader.But...

Recently,astartupbytwostudentsofastateuniversityofcityFgainedincrediblepopularity.Nowit'stimetostartanewcompany.Butwhatdowecallit?Themarketanalystscameupwithaverysmartplan:thenameofthecompanyshouldbeidenticaltoitsreflectioninamirror!Inotherwords,ifwewriteoutthenameofthecompanyonapieceofpaperinaline(horizontally,fromlefttoright)withlargeEnglishletters,thenputthispieceofpaperinfrontofthemirro...
近期评论