結果

問題 No.1041 直線大学
ユーザー 双六双六
提出日時 2020-08-12 03:36:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 73,472 KB
最終ジャッジ日時 2024-11-16 08:07:57
合計ジャッジ時間 3,634 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def distance(Ax, Ay, Bx, By, Cx, Cy):
	a = By - Ay; b = Ax - Bx; c = (Ay - By) * Ax + (Bx - Ax) * Ay
	L = abs(a * Cx + b * Cy + c) / ((a ** 2 + b ** 2) ** 0.5)
	return L

#処理内容
def main():
	N = int(input())
	L = []
	for i in range(N):
		x, y = getlist()
		L.append([x, y])

	ans = 0
	for i in range(N):
		for j in range(i + 1, N):
			val = 0
			Ax, Ay = L[i]
			Bx, By = L[j]
			for k in range(N):
				Cx, Cy = L[k]
				if distance(Ax, Ay, Bx, By, Cx, Cy) == 0:
					val += 1

			ans = max(ans, val)

	print(ans)

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