ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 6744 |
문제명 | Parallelogram Counting |
레벨 | 플래티넘 4 |
분류 |
기하학 |
시간복잡도 | O(t*n^2) |
인풋사이즈 | t<=10, n<=1000 |
사용한 언어 | Python 3.13 |
제출기록 | 137228KB / 2124ms |
최고기록 | 2124ms |
해결날짜 | 2025/02/19 |
"""Solution code for "BOJ 6744. Parallelogram Counting".
- Problem link: https://www.acmicpc.net/problem/6744
- Solution link: http://www.teferi.net/ps/problems/boj/6744
Tags: [geometry]
"""
import collections
import itertools
import sys
from teflib import psutils
@psutils.run_n_times
def main():
N = int(sys.stdin.readline())
P = [[int(x) for x in sys.stdin.readline().split()] for _ in range(N)]
pair_by_center = collections.Counter(
(px + qx, py + qy)
for (px, py), (qx, qy) in itertools.combinations(P, 2)
)
answer = sum(c * (c - 1) // 2 for c in pair_by_center.values())
print(answer)
if __name__ == '__main__':
main()