結果

問題 No.1041 直線大学
ユーザー toshiro_yanagi
提出日時 2020-07-13 03:37:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 554 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-06 18:06:24
合計ジャッジ時間 3,452 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import namedtuple
from fractions import gcd
P = namedtuple("P", "x y")

n = int(input())
ps = list()

for i in range(n):
    x, y = map(int, input().split())
    ps.append(P(x, y))

ps.sort()
dic = dict()

for i in range(n):
    for j in range(i + 1, n):
        x = ps[j].x - ps[i].x
        y = ps[j].y - ps[i].y
        x, y = x // gcd(x, y), y // gcd(x, y)
        if (i, x, y) not in dic:
            dic[(i, x, y)] = 2
        else:
            dic[(i, x, y)] += 1

ans = 0
for v in dic.values():
    ans = max(ans, v)

print(ans)
0