結果

問題 No.1041 直線大学
ユーザー hiragnhiragn
提出日時 2022-11-19 23:03:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-16 08:15:08
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    points = [list(map(int, input().split())) for _ in range(n)]

    mx = 0
    for i in range(n):
        for j in range(i + 1, n):
            x1, y1 = points[i]
            x2, y2 = points[j]
            cnt = 0
            for k in range(j + 1, n):
                x, y = points[k]
                if (x - x2) * (y2 - y1) == (x2 - x1) * (y - y2):
                    cnt += 1
            mx = max(mx, cnt)

    ans = mx + 2
    print(ans)


if __name__ == "__main__":
    main()
0