#C6325. Count Unique Coordinate Spots
Count Unique Coordinate Spots
Count Unique Coordinate Spots
You are given a list of coordinate pairs in the 2D plane. Each coordinate is described by two integers representing the X and Y positions. Your task is to determine the number of unique coordinate pairs.
Formally, if the list of coordinates is given by \(\{(x_i, y_i)\}_{i=1}^n\), you need to compute the size of the set:
[ S = {(x_i,y_i);:;1 \le i \le n} ]
For example, for the coordinate list:
8 1 2 2 3 1 2 4 5 4 5 6 7 8 9 6 7
the answer is 5
since there are 5 unique coordinate pairs.
inputFormat
The input is read from stdin
and has the following format:
- An integer
n
which indicates the number of coordinate pairs. n
lines follow, each line containing two space-separated integers representing the coordinatesx
andy
.
\(1 \leq n \leq 10^5\) and the coordinate values are integers.
outputFormat
Output the number of unique coordinate pairs to stdout
.
The result is a single integer representing the count of distinct points.
## sample8
1 2
2 3
1 2
4 5
4 5
6 7
8 9
6 7
5