https://codeforces.com/gym/102951/problem/A
I was solving this under the guide, and I brute forced it but CF says timed out on problem 10.
It was very similar to the example problem in the guide notes, so I’m not sure why my solution is timing out.
My code:
import itertools
N = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
max_dist = 0
for i, j in itertools.combinations(range(N), 2):
if (x[i]-x[j])**2 + (y[i]-y[j])**2 > max_dist:
max_dist = (x[i] - x[j])**2 + (y[i] - y[j])**2
print(max_dist)
Thanks