Yesterday A is violence, then pay attention to the special sentence,
B is the first sort, then n ^ 2 one by one to try on the line
Ma Hongru
Problem C Solution: should be easy to think of the answer is the same point on the horizontal axis of the number of points + the same vertical axis logarithmic - logarithmic coordinates of the same points (minus the count is repeated again)
so the statistics on each abscissa points cntx [i], the number of points on each ordinate cnty [j], the number of points at each point cntxy [k],
the answer is cntx [i] * (cntx [ i] -1) / 2 + cnty [j ] * (Cnty [J] -1) / 2 - cntxy [K] * (cntxy [K] -1) / 2;
(I enumerate each abscissa, j enumerate each ordinate, k for each enumeration points)
n-is 2E5, 1E9 coordinates, so use three statistical map, map with stored coordinate points pair (or reload <a struct, map or map units). Code:
so the statistics on each abscissa points cntx [i], the number of points on each ordinate cnty [j], the number of points at each point cntxy [k],
the answer is cntx [i] * (cntx [ i] -1) / 2 + cnty [j ] * (Cnty [J] -1) / 2 - cntxy [K] * (cntxy [K] -1) / 2;
(I enumerate each abscissa, j enumerate each ordinate, k for each enumeration points)
n-is 2E5, 1E9 coordinates, so use three statistical map, map with stored coordinate points pair (or reload <a struct, map or map units). Code:
Sun Chenxi