http://218.5.5.242:9018/JudgeOnline/problem.php?id=1592题目描述FarmerJohn'sNcows(1<=N<=100,000)arestandingatvariouspositionsalongalongone-dimensionalfence. Theithcowisstandingatpositionx_i(anintegerintherange0...1,000,000,000)andhasbreedb_i(either'G'forGuernseyor'H'forHolstein). Notwocowsoccupythesameposition.FJwantstotakeaphotoofacontiguousintervalofcowsforthecountyfair,butw...
Useraintahasapermutationp1, p2, ..., pn.AstheNewYeariscoming,hewantstomakehispermutationasprettyaspossible.Permutationa1, a2, ..., anisprettierthanpermutationb1, b2, ..., bn,ifandonlyifthereexistsanintegerk(1 ≤ k ≤ n)wherea1 = b1, a2 = b2, ..., ak - 1 = bk - 1andak < bkallholds.Asknown,permutationpissosensitivethatitcouldbeonlymodifiedbyswappingtwodistinctele...
Youareanassistantdirectorinanewmusicalplay.Theplayconsistsofnmusicalparts,eachpartmustbeperformedbyexactlyoneactor.Afterthecastingthedirectorchosemactorswhocantakepartintheplay.Yourtaskistoassignthepartstoactors.However,thereareseverallimitations.First,eachactorhasacertainvoicerangeandtherearesomepartsthathecannotsing.Formally,therearetwointegersforeachactor,cianddi(ci ≤ di) —thepitcho...
PetyaandGenaloveplayingtabletennis.Asinglematchisplayedaccordingtothefollowingrules:amatchconsistsofmultiplesets,eachsetconsistsofmultipleserves.Eachserveiswonbyoneoftheplayers,thisplayerscoresonepoint.Assoonasoneoftheplayersscorestpoints,hewinstheset;thenthenextsetstartsandscoresofbothplayersarebeingsetto0.Assoonasoneoftheplayerswinsthetotalofssets,hewinsthematchandthematchisover.Heresandt...
近期评论