답안 #1100562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100562 2024-10-14T09:08:17 Z vjudge1 별들과 삼각형 (IZhO11_triangle) PyPy
0 / 100
26 ms 19760 KB
from collections import defaultdict
n = int(input())
stars = []
for _ in range(n):
    x, y = map(int, input().split())
    stars.append((x, y))
xc = defaultdict(int)
yc = defaultdict(int)
for x, y in stars:
    xc[x] += 1
    yc[y] += 1
total_triangles = 0
mp = defaultdict(int)
for x, y in stars:
    mp[(x, y)] += 1
for x, y in stars:
    x_leg = xc[x] - mp[(x, y)]
    y_leg = yc[y] - mp[(x, y)]
    total_triangles += x_leg * y_leg
print(total_triangles)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 19760 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -