DescriptionJohnistheonlypriestinhistown.September1stistheJohn'sbusiestdayinayearbecausethereisanoldlegendinthetownthatthecouplewhogetmarriedonthatdaywillbeforeverblessedbytheGodofLove.ThisyearNcouplesplantogetmarriedontheblessedday.Thei-thcoupleplantoholdtheirweddingfromtimeSitotimeTi.Accordingtothetraditionsinthetown,theremustbeaspecialceremonyonwhichthecouplestandbeforethepriestandac...
Descriptionliympanda,oneofIkki’sfriend,likesplayinggameswithIkki.TodayafterminesweepingwithIkkiandwinningsomanytimes,heistiredofsucheasygamesandwantstoplayanothergamewithIkki.liympandahasamagiccircleandheputsitonaplane,therearenpointsonitsboundaryincircularborder:0,1,2,…,n−1.Evilpandaclaimsthatheisconnectingmpairsofpoints.Toconnecttwopoints,liympandaeitherplacesthelinkentirelyinsidethec...
Hamedhasrecentlyfoundastringtandsuddenlybecamequitefondofit.Hespentseveraldaystryingtofindalloccurrencesoftinotherstringshehad.Finallyhebecametiredandstartedthinkingaboutthefollowingproblem.Givenastringshowmanywaysaretheretoextractk ≥ 1non-overlappingsubstringsfromitsuchthateachofthemcontainsstringtasasubstring?Moreformally,youneedtocalculatethenumberofwaystochoosetwosequencesa1, a2, ......
Malekhasrecentlyfoundatreasuremap.Whilehewaslookingforatreasurehefoundalockeddoor.Therewasastringswrittenonthedoorconsistingofcharacters'(',')'and'#'.Belowtherewasamanualonhowtoopenthedoor.AfterspendingalongtimeMalekmanagedtodecodethemanualandfoundoutthatthegoalistoreplaceeach'#'withoneormore')'characterssothatthefinalstringbecomesbeautiful.Belowtherewasalsowrittenthatastringiscalledbeautif...
ProblemDescriptionYouaregivenatreewithNnodeswhicharenumberedbyintegers1..N.Eachnodeisassociatedwithanintegerastheweight.YourtaskistodealwithMoperationsof4types:1.Deleteanedge(x,y)fromthetree,andthenaddanewedge(a,b).Weensurethatitstillconstitutesatreeafteraddingthenewedge.2.Giventwonodesaandbinthetree,changetheweightsofallthenodesonthepathconnectingnodeaandb(includingnodeaandb)toaparticu...
近期评论