DescriptionYouareworkingforMacrohardcompanyindatastructuresdepartment.Afterfailingyourprevioustaskaboutkeyinsertionyouwereaskedtowriteanewdatastructurethatwouldbeabletoreturnquicklyk-thorderstatisticsinthearraysegment.Thatis,givenanarraya[1...n]ofdifferentintegernumbers,yourprogrammustansweraseriesofquestionsQ(i,j,k)intheform:"Whatwouldbethek-thnumberina[i...j]segment,ifthissegmentwassorted...
IahubistrainingfortheIOI.WhatisabetterwaytotrainthanplayingaZuma-likegame?Thereare n ballsputinarow.Eachballiscoloredinoneof k colors.Initiallytherowdoesn'tcontainthreeormorecontiguousballswiththesamecolor.Iahubhasasingleballofcolor x.Hecaninserthisballatanypositionintherow(probably,betweentwootherballs).Ifatanymomenttherearethreeormorecontiguousballsofthesamecolorintherow,theyare...
Iahubisn'twellpreparedongeometryproblems,butheheardthatthisyeartherewillbealotofgeometryproblemsontheIOIselectioncamp.Scared,Iahublockedhimselfinthebasementandstartedthinkingofnewproblemsofthiskind.Oneofthemisthefollowing.Iahubwantstodraw n distinctpointsand m segmentsonthe OX axis.Hecandraweachpointwitheitherredorblue.Thedrawingisgoodifandonlyifthefollowingrequirementismet:forea...
近期评论