結果

問題 No.1041 直線大学
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2022-07-06 11:24:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 893 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 67,328 KB
最終ジャッジ日時 2024-11-16 08:14:18
合計ジャッジ時間 3,012 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

bufio_scanner = []


def main():
    n = int(fmt_scan())
    s = []
    ln = dict()

    for _ in range(n):
        x, y = [int(fmt_scan()) for _ in range(2)]
        for v in s:
            if v[0] != x:
                a = (y - v[1]) / (x - v[0])
                b = (x * v[1] - v[0] * y) / (x - v[0])
                ln[(a, b)] = 0
            else:
                ln[x] = 0
        s.append((x, y))

    ans = 0
    for p in ln:
        for v in s:
            x, y = v
            if isinstance(p, int):
                if x == p:
                    ln[p] += 1
            else:
                a, b = p
                if y == a * x + b:
                    ln[p] += 1
            ans = max(ans, ln[p])
    print(ans)


def fmt_scan() -> str:
    sc = bufio_scanner
    if len(sc) == 0:
        for v in reversed(input().split()):
            sc.append(v)
    return sc.pop()


main()
0