aboutsummaryrefslogtreecommitdiff
path: root/triangles.py
blob: 3f293cd759b01c407189c4f8efe4c1acef89a0e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
with open("triangles.in", "r") as fin:
	L = list(fin)
	N = int(L[0])

	X = []
	Y = []
	for i in range(1, N + 1):
		x, y = map(int, L[i].split())
		X.append(x)
		Y.append(y)

ans = 0
for i in range(0, N):
	for j in range(i + 1, N):
		for k in range(j + 1, N):
			base = 0
			height = 0
			
			if X[i] == X[j]:
				height = abs(Y[j] - Y[i])
			elif X[j] == X[k]:
				height = abs(Y[k] - Y[j])
			elif X[k] == X[i]:
				height = abs(Y[i] - Y[k])
			else:
				continue

			if Y[i] == Y[j]:
				base = abs(X[j] - X[i])
			elif Y[j] == Y[k]:
				base = abs(X[k] - X[j])
			elif Y[k] == Y[i]:
				base = abs(X[i] - X[k])
			else:
				continue

			if base*height > ans: ans = base*height

with open("triangles.out", "w") as fout:
	fout.write(str(ans))