n = int(input())
p = [[0, 0] for _ in range(n)]
x = [0] * n
y = [0] * n
xsum = [0] * n
ysum = [0] * n
ans = 0
for i in range(n):
x[i], y[i] = map(int, input().split())
p[i][0] = x[i]
p[i][1] = y[i]
x.sort()
y.sort()
for i in range(n):
p[i][0] = x.index(p[i][0])
p[i][1] = y.index(p[i][1])
xsum[p[i][0]] += 1
ysum[p[i][1]] += 1
for i in range(n):
ans += (xsum[p[i][0]] - 1) * (ysum[p[i][1]] - 1)
print(ans)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2896 KB |
Output is correct |
2 |
Correct |
12 ms |
2896 KB |
Output is correct |
3 |
Correct |
12 ms |
2912 KB |
Output is correct |
4 |
Correct |
12 ms |
2896 KB |
Output is correct |
5 |
Correct |
12 ms |
2896 KB |
Output is correct |
6 |
Correct |
12 ms |
2896 KB |
Output is correct |
7 |
Correct |
12 ms |
2896 KB |
Output is correct |
8 |
Correct |
12 ms |
2896 KB |
Output is correct |
9 |
Correct |
15 ms |
2896 KB |
Output is correct |
10 |
Correct |
17 ms |
3168 KB |
Output is correct |
11 |
Correct |
19 ms |
3148 KB |
Output is correct |
12 |
Correct |
998 ms |
5448 KB |
Output is correct |
13 |
Correct |
733 ms |
5240 KB |
Output is correct |
14 |
Correct |
1122 ms |
5372 KB |
Output is correct |
15 |
Execution timed out |
2058 ms |
21628 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |