M - Суперцентральная точка

public
yeskendir.sultanov Apr 26, 2024 Never 142
Clone
Python 45.py 34 lines (30 loc) | 871 Bytes
1
n = int(input())
2
p = []
3
for i in range(n):
4
x, y = map(int, input().split())
5
p.append((x, y))
6
7
ans = 0
8
9
for i in range(n):
10
up = False
11
for j in range(n):
12
if i != j and p[i][0] == p[j][0] and p[i][1] < p[j][1]:
13
up = True
14
break
15
bottom = False
16
for j in range(n):
17
if i != j and p[i][0] == p[j][0] and p[i][1] > p[j][1]:
18
bottom = True
19
break
20
left = False
21
for j in range(n):
22
if i != j and p[i][0] > p[j][0] and p[i][1] == p[j][1]:
23
left = True
24
break
25
right = False
26
for j in range(n):
27
if i != j and p[i][0] < p[j][0] and p[i][1] == p[j][1]:
28
right = True
29
break
30
31
if up == True and bottom == True and left == True and right == True:
32
ans += 1
33
34
print(ans)