Problem p03006 (python)

Fixed submission:
# 未完成

import sys
N = int(input())
x = [0]*N
y = [0]*N
kouholist = []
ans = N
if N == 1:
    print(1)
    sys.exit()

for i in range(N):
    x[i], y[i] = map(int, input().split())
for m in range(N):
    for p in range(N):
        if m == p:
            continue
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = N
        for r in range(N):
            for q in range(N):
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans_kari -= 1
        if ans_kari < ans:
            ans = ans_kari

print("{}".format(ans))

Buggy submission (verdict: Runtime Error):
# 未完成
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)
kouholist = []

if N == 1:
    print(1)
else:
    for i in range(N):
        x[i], y[i] = map(int, input().split())
    for m in range(N):
        for p in range(N):
            if m == p:
                continue
            diff_x = x[m] - x[p]
            diff_y = y[m] - y[p]
            if (diff_x, diff_y) not in kouholist:
                kouholist.append((diff_x, diff_y))

    for list_i in kouholist:
        ans_kari = 0
        for r in range(N):
            for q in range(N):
                if r == q:
                    continue
                if x[q] - x[r] == list_i[0] and y[q] - y[r] == list_i[1]:
                    ans_kari += 1
        ans.append(ans_kari)

    print("{}".format(N-max(ans)))

Buggy submission (verdict: Runtime Error):
# 未完成
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)
kouholist = []

for i in range(N):
    x[i], y[i] = map(int, input().split())
ans = []
for m in range(N):
    for p in range(N):
        if m == p:
            continue
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = 0
        if (diff_x, diff_y) not in kouholist:
            kouholist.append((diff_x, diff_y))

for list_i in kouholist:
    ans_kari=0
    for r in range(N):
        for q in range(N):
            if r == q:
                continue
            if x[q] - x[r] == list_i[0] and y[q] - y[r] == list_i[1]:
                ans_kari += 1
    ans.append(ans_kari)

print("{}".format(N-max(ans)))

Buggy submission (verdict: Runtime Error):
# 未完成
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)
kouhokist = []

for i in range(N):
    x[i], y[i] = map(int, input().split())
ans = []
for m in range(N):
    for p in range(N):
        if m == p:
            continue
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = 0
        for r in range(N):
            for q in range(N):
                if r == q:
                    continue
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans_kari += 1
        ans.append(ans_kari)

print("{}".format(N-max(ans)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)

for i in range(N):
    x[i], y[i] = map(int, input().split())
for j in range(N):
    for k in range(N-1):
        if x[k] > x[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]
        elif x[k] == x[k + 1] and y[k] > y[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]

ans = []
for p in range(N-1):
    for m in range(p+1, N):
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        ans_kari = 0
        for r in range(N-1):
            for q in range(r+1, N):
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans_kari += 1
        ans.append(ans_kari)

print("{}".format(N-max(ans)))

Buggy submission (verdict: Runtime Error):
# 未完成
import numpy as np
N = int(input())
x = np.zeros(N)
y = np.zeros(N)

for i in range(N):
    x[i], y[i] = map(int, input().split())
for j in range(N):
    for k in range(N-1):
        if x[k] > x[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]
        elif x[k] == x[k + 1] and y[k] > y[k + 1]:
            x[k], y[k] = x[k + 1], y[k + 1]

ans = np.zeros(N*N-N)
ite = 0
for m in range(N):
    for p in range(m):
        diff_x = x[m] - x[p]
        diff_y = y[m] - y[p]
        for r in range(N-1):
            for q in range(r+1, N):
                if x[q] - x[r] == diff_x and y[q] - y[r] == diff_y:
                    ans[ite] += 1
        ite += 1
ans_min = ans[0]
for z in range(ite):
    if ans_min < ans[z]:
        ans_min = ans[z]

print("{}".format(int(N-ans_min)))