HaveyoueverplayedHanabi?Ifnot,thenyou'vegottotryitout!Thisproblemdealswithasimplifiedversionofthegame.Overall,thegamehas25typesofcards(5distinctcolorsand5distinctvalues).Boryaisholding n cards.ThegameissomewhatcomplicatedbythefactthateverybodyseesBorya'scardsexceptforBoryahimself.Boryaknowswhichcardshehasbutheknowsnothingabouttheordertheyliein.NotethatBoryacanhavemultipleidenticalcar...
Valeraisacollector.Oncehewantedtoexpandhiscollectionwithexactlyoneantiqueitem.Valeraknows n sellersofantiques,the i-thofthemauctioned ki items.Currentlytheauctionpriceofthe j-thobjectofthe i-thsellerissij.Valeragetsonwellwitheachofthe n sellers.Heisperfectlysurethatifheoutbidsthecurrentpriceofoneoftheitemsintheauction(inotherwords,offersthesellerthemoneythatisstrictlygreaterthanthec...
Devuisarenownedclassicalsinger.Heisinvitedtomanybigfunctions/festivals.Recentlyhewasinvitedto"AllWorldClassicalSingingFestival".OtherthanDevu,comedianChuruwasalsoinvited.Devuhasprovidedorganizersalistofthesongsandrequiredtimeforsingingthem.Hewillsing n songs,ith songwilltake ti minutesexactly.TheComedian,Churuwillcrackjokes.Allhisjokesareof5minutesexactly.Peoplehavemainlycom...
Petyahas k matches,placedin n matchboxeslyinginalinefromlefttoright.Weknowthat k isdivisibleby n.Petyawantsallboxestohavethesamenumberofmatchesinside.Forthat,hecanmoveamatchfromitsboxtotheadjacentoneinonemove.Howmanysuchmovesdoesheneedtoachievethedesiredconfiguration?InputThefirstlinecontainsinteger n (1 ≤ n ≤ 50000).Thesecondlinecontains n non-negativenumbersthatdonotexce...
PolycarpusadoresTVseries.Rightnowheisreadytofinishwatchingaseasonofapopularsitcom"GraphTheory".Intotal,theseasonhas n episodes,numberedwithintegersfrom 1 to n.Polycarpuswatchesepisodesnotonebyonebutinarandomorder.Hehasalreadywatchedalltheepisodesexceptforone.WhichepisodehasPolycaprusforgottentowatch?InputThefirstlineoftheinputcontainsinteger n (2 ≤ n ≤ 100000) —thenumbe...
Onceuponatimeachildgotatestconsistingofmultiple-choicequestionsashomework.Amultiple-choicequestionconsistsoffourchoices: A, B, C and D.Eachchoicehasadescription,andthechildshouldfindouttheonlyonethatiscorrect.Fortunatelythechildknowshowtosolvesuchcomplicatedtest.Thechildwillfollowthealgorithm:Ifthereissomechoicewhosedescriptionatleasttwiceshorterthanallotherdescriptions,oratleasttwi...
Inthisproblem,yourtaskistouseASCIIgraphicstopaintacardiogram.Acardiogramisapolylinewiththefollowingcorners:Thatis,acardiogramisfullydefinedbyasequenceofpositiveintegers a1, a2, ..., an.Yourtaskistopaintacardiogrambygivensequence ai.InputThefirstlinecontainsinteger n (2 ≤ n ≤ 1000).Thenextlinecontainsthesequenceofintegersa1, a2, ..., an (1 ≤ ai ≤ 1000).Itisguaran...
It'sthattimeoftheyearwhentheRussiansfloodtheircountrysidesummercottages(dachas)andthebusstophasalotofpeople.Peoplerarelygotothedachaontheirown,it'susuallyagroup,sothepeoplestandinqueuebygroups.Thebusstopqueuehas n groupsofpeople.The i-thgroupfromthebeginninghas ai people.Every30 minutesanemptybusarrivesatthebusstop,itcancarryatmost m people.Naturally,thepeoplefromthefirstgroupentert...
KitaharaHarukihasbought n applesforToumaKazusaandOgisoSetsuna.Nowhewantstodividealltheapplesbetweenthefriends.Eachappleweights100gramsor200grams.OfcourseKitaharaHarukidoesn'twanttooffendanyofhisfriend.ThereforethetotalweightoftheapplesgiventoToumaKazusamustbeequaltothetotalweightoftheapplesgiventoOgisoSetsuna.ButunfortunatelyKitaharaHarukidoesn'thaveakniferightnow,sohecannotsp...
近期评论