# BOJ - 7571 - 점 모으기

Updated:

```
import sys
def solution():
N, M = map(int, sys.stdin.readline().split())
x, y = [], []
for _ in range(M):
a, b = map(int, sys.stdin.readline().split())
x.append(a)
y.append(b)
midX = sorted(x)[M // 2]
midY = sorted(y)[M // 2]
answer = 0
for i in range(M):
answer += abs(midX - x[i]) + abs(midY - y[i])
print(answer)
solution()
```

https://www.acmicpc.net/problem/7571

## Leave a comment