TheemployeesoftheR1companyoftenspendtimetogether:theywatchfootball,theygocamping,theysolvecontests.So,it'snobigdealthatsometimessomeonepaysforsomeoneelse.Todayisthedayofgivingoutmoneyrewards.TheR1companyCEOwillinviteemployeesintohisofficeonebyone,rewardingeachoneforthehardworkthismonth.TheCEOknowswhoowesmoneytowhom.Andhealsounderstandsthatifheinvitesperson x tohisofficeforareward,a...
DescriptionBessieisinCamelotandhasencounteredastickysituation:sheneedstopassthroughtheforestthatisguardedbytheKnightsofNi.Inordertopassthroughsafely,theKnightshavedemandedthatshebringthemasingleshrubbery.Timeisoftheessence,andBessiemustfindandbringthemashrubberyasquicklyaspossible.Bessiehasamapofoftheforest,whichispartitionedintoasquaregridarrayedintheusualmanner,withaxesparalleltotheXa...
DescriptionFarmerJohnhasbeeninformedofthelocationofafugitivecowandwantstocatchherimmediately.HestartsatapointN(0<=N<=100,000)onanumberlineandthecowisatapointK(0<=K<=100,000)onthesamenumberline.FarmerJohnhastwomodesoftransportation:walkingandteleporting.*Walking:FJcanmovefromanypointXtothepointsX-1orX+1inasingleminute*Teleporting:FJcanmovefromanypointXtothepoint2*Xi...
DescriptionThecowsarehavingapicnic!EachofFarmerJohn'sK(1<=K<=100)cowsisgrazinginoneofN(1<=N<=1,000)pastures,convenientlynumbered1...N.ThepasturesareconnectedbyM(1<=M<=10,000)one-waypaths(nopathconnectsapasturetoitself).Thecowswanttogatherinthesamepasturefortheirpicnic,but(becauseoftheone-waypaths)somecowsmayonlybeabletogettosomepastures.Helpthecowsoutbyfiguringouth...
DescriptionAcm,atreasure-explorer,isexploringagain.Thistimeheisinaspecialmaze,inwhichtherearesomedoors(atmost5doors,representedby'A','B','C','D','E'respectively).Inordertofindthetreasure,Acmmayneedtoopendoors.However,toopenadoorheneedstofindallthedoor'skeys(atleastone)inthemazefirst.Forexample,ifthereare3keysofDoorA,toopenthedoorheshouldfindallthe3keysfirst(that'sthree'a'swhichdenote...
近期评论