DescriptionEveryyearthecowsholdaneventfeaturingapeculiarversionofhopscotchthatinvolvescarefullyjumpingfromrocktorockinariver.Theexcitementtakesplaceonalong,straightriverwitharockatthestartandanotherrockattheend,Lunitsawayfromthestart(1<=L<=1,000,000,000).Alongtheriverbetweenthestartingandendingrocks,N(0<=N<=50,000)morerocksappear,eachatanintegraldistanceDifromthestart(0<Di...
Serejahaspainted n distinctpointsontheplane.Thecoordinatesofeachpointareintegers.Nowheiswondering:howmanysquaresaretherewithsidesparalleltothecoordinateaxesandwithpointspaintedinallitsfourvertexes?Helphim,calculatethisnumber.InputThefirstlinecontainsinteger n (1 ≤ n ≤ 105).Eachofthenext n linescontainstwointegers xi, yi (0 ≤ xi, yi ≤ 105),theintegersrepresentthecoordin...
近期评论