# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1100562 | vjudge1 | Star triangles (IZhO11_triangle) | Pypy 2 | 26 ms | 19760 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |