RecentlyPashmakhasbeenemployedinatransportationcompany.Thecompanyhas k busesandhasacontractwithaschoolwhichhas n students.Theschoolplannedtotakethestudentsto d differentplacesfor d days(eachdayinoneplace).Eachdaythecompanyprovidesallthebusesforthetrip.Pashmakhastoarrangethestudentsinthebuses.Hewantstoarrangethestudentsinawaythatnotwostudentsbecomeclosefriends.Inhisridiculousidea,tw...
Youaregivenarectangulargridoflatticepointsfrom (0, 0) to (n, m) inclusive.Youhavetochooseexactly4differentpointstobuildapolylinepossiblywithself-intersectionsandself-touching.Thispolylineshouldbeaslongaspossible.Apolylinedefinedbypoints p1, p2, p3, p4 consistsofthelinesegments p1 p2, p2 p3, p3 p4,anditslengthisthesumofthelengthsoftheindividuallinesegments.InputTheonlylineoft...
Devubeingasmallkid,likestoplayalot,butheonlylikestoplaywitharrays.Whileplayinghecameupwithaninterestingquestionwhichhecouldnotsolve,canyoupleasesolveitforhim?Givenanarrayconsistingofdistinctintegers.Isitpossibletopartitionthewholearrayinto k disjointnon-emptypartssuchthat p ofthepartshaveevensum(eachofthemmusthaveevensum)andremaining k - p haveoddsum?(notethatpartsneednottobecontinuous...
Iahubisn'twellpreparedongeometryproblems,butheheardthatthisyeartherewillbealotofgeometryproblemsontheIOIselectioncamp.Scared,Iahublockedhimselfinthebasementandstartedthinkingofnewproblemsofthiskind.Oneofthemisthefollowing.Iahubwantstodraw n distinctpointsand m segmentsonthe OX axis.Hecandraweachpointwitheitherredorblue.Thedrawingisgoodifandonlyifthefollowingrequirementismet:forea...
It'sholiday.Mashmokhandhisboss,Bimokh,areplayingagameinventedbyMashmokh.InthisgameMashmokhwritessequenceof n distinctintegersontheboard.ThenBimokhmakesseveral(possiblyzero)moves.Onthefirstmoveheremovesthefirstandthesecondintegerfromfromtheboard,onthesecondmoveheremovesthefirstandthesecondintegeroftheremainingsequencefromtheboard,andsoon.Bimokhstopswhentheboardcontainslessthantwonumbers...
近期评论