DescriptionJohnistheonlypriestinhistown.September1stistheJohn'sbusiestdayinayearbecausethereisanoldlegendinthetownthatthecouplewhogetmarriedonthatdaywillbeforeverblessedbytheGodofLove.ThisyearNcouplesplantogetmarriedontheblessedday.Thei-thcoupleplantoholdtheirweddingfromtimeSitotimeTi.Accordingtothetraditionsinthetown,theremustbeaspecialceremonyonwhichthecouplestandbeforethepriestandac...
Descriptionliympanda,oneofIkki’sfriend,likesplayinggameswithIkki.TodayafterminesweepingwithIkkiandwinningsomanytimes,heistiredofsucheasygamesandwantstoplayanothergamewithIkki.liympandahasamagiccircleandheputsitonaplane,therearenpointsonitsboundaryincircularborder:0,1,2,…,n−1.Evilpandaclaimsthatheisconnectingmpairsofpoints.Toconnecttwopoints,liympandaeitherplacesthelinkentirelyinsidethec...
ProblemDescriptionYouaregivenatreewithNnodeswhicharenumberedbyintegers1..N.Eachnodeisassociatedwithanintegerastheweight.YourtaskistodealwithMoperationsof4types:1.Deleteanedge(x,y)fromthetree,andthenaddanewedge(a,b).Weensurethatitstillconstitutesatreeafteraddingthenewedge.2.Giventwonodesaandbinthetree,changetheweightsofallthenodesonthepathconnectingnodeaandb(includingnodeaandb)toaparticu...
ProblemDescriptionWehavemetsomanyproblemsonthetree,sotodaywewillhaveaqueryproblemonasetoftrees.ThereareNnodes,eachnodewillhaveauniqueweightWi.Wewillhavefourkindsofoperationsonitandyoushouldsolvethemefficiently.Wishyouhavefun! InputTherearemultipletestcasesinourdataset.Foreachcase,thefirstlinecontainsonlyoneintegerN.(1≤N≤300000)ThenextN‐1lineseachcontainstwointegersx,ywhichme...
近期评论