結果

問題 No.1041 直線大学
コンテスト
ユーザー H3PO4
提出日時 2020-05-01 21:40:19
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 55 ms / 2,000 ms
+ 662µs
コード長 452 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 59 ms
コンパイル使用メモリ 15,232 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2026-09-24 07:19:08
合計ジャッジ時間 4,010 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools
from collections import Counter
from fractions import Fraction
from math import isqrt

N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]
ct = []
for (x0, y0), (x1, y1) in itertools.combinations(P, 2):
    if x0 != x1:
        d = Fraction(y1 - y0, x1 - x0)
        c = y0 - x0 * d
    else:
        d = float('inf')
        c = x0
    ct.append((c,d))
ct = Counter(ct)
M=max(ct.values())
print(isqrt(M * 2) + 1)
0