結果

問題 No.2769 Number of Rhombi
ユーザー KDKJKDKJ
提出日時 2024-05-31 22:41:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 941 ms / 5,000 ms
コード長 1,536 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 207,548 KB
最終ジャッジ日時 2024-05-31 22:41:41
合計ジャッジ時間 25,125 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
88,776 KB
testcase_01 AC 146 ms
88,892 KB
testcase_02 AC 173 ms
88,752 KB
testcase_03 AC 713 ms
109,948 KB
testcase_04 AC 703 ms
105,972 KB
testcase_05 AC 579 ms
103,172 KB
testcase_06 AC 761 ms
108,416 KB
testcase_07 AC 930 ms
114,308 KB
testcase_08 AC 929 ms
114,668 KB
testcase_09 AC 890 ms
115,144 KB
testcase_10 AC 822 ms
116,148 KB
testcase_11 AC 733 ms
111,192 KB
testcase_12 AC 734 ms
112,532 KB
testcase_13 AC 681 ms
114,096 KB
testcase_14 AC 720 ms
119,120 KB
testcase_15 AC 701 ms
120,748 KB
testcase_16 AC 729 ms
126,376 KB
testcase_17 AC 744 ms
133,684 KB
testcase_18 AC 661 ms
147,456 KB
testcase_19 AC 657 ms
153,604 KB
testcase_20 AC 629 ms
159,904 KB
testcase_21 AC 616 ms
180,440 KB
testcase_22 AC 559 ms
195,948 KB
testcase_23 AC 512 ms
207,548 KB
testcase_24 AC 153 ms
89,020 KB
testcase_25 AC 704 ms
113,892 KB
testcase_26 AC 721 ms
115,516 KB
testcase_27 AC 698 ms
131,756 KB
testcase_28 AC 733 ms
124,944 KB
testcase_29 AC 606 ms
161,424 KB
testcase_30 AC 731 ms
127,724 KB
testcase_31 AC 725 ms
112,552 KB
testcase_32 AC 894 ms
114,644 KB
testcase_33 AC 941 ms
114,696 KB
testcase_34 AC 854 ms
115,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify
from collections import defaultdict, deque,Counter
from math import ceil, floor, sqrt, factorial,gcd,cos,sin,pi
from itertools import permutations, combinations,product
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import Fraction
from random import randint
import sys
from functools import cache,lru_cache #@lru_cache(maxsize=None)
from time import time
#from sortedcontainers import SortedList # type: ignore
#sys.setrecursionlimit(10**6)
vector1 = [[0, -1], [1, 0], [0, 1], [-1, 0]]
vector2 = [[0, 1], [1, 0], [-1, 0], [0, -1],
           [1,-1], [-1, 1], [1, 1], [-1, -1]]
alphabet = "abcdefghijklmnopqrstuvwxyz"


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    
    N = int(input())
    p = [list(map(int,input().split())) for _ in range(N)]
    d = defaultdict(list)
    ans = 0
    for i in range(N):
        for j in range(i+1,N):
            cx = p[i][0] + p[j][0]
            cy = p[i][1] + p[j][1]
            vx = p[i][0] - p[j][0]
            vy = p[i][1] - p[j][1]
            for ux,uy in d[(cx,cy)]:
                if vx * ux + vy*uy == 0:
                    ans += 1
            d[(cx,cy)].append((vx,vy))
    print(ans)
    

if __name__ == '__main__':
    main()


0