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
|
x ,y = [int(x) for x in str(input()).split()]
R = []
for m in range(x):
mx,my = [int(x) for x in str(input()).split()]
R.append(tuple((mx,my)))
num = 0
for x in range(-3,4):
if len(set(R) & set([(x,0)])) > 0:
# 正方形竖边
if (x,x) in R and (x,-x) in R:
num += 1
# X正半轴
if x==2 and (x+1,0) in R and (x-1,0) in R:
num += 1
# X负半轴
if x==-2 and (x+1,0) in R and (x-1,0) in R:
num += 1
if len(set(R) & set([(0,x)])) > 0:
# 正方形横边
if (x,x) in R and (-x,x) in R:
num += 1
# Y正半轴
if x == 2 and (0, x+1) in R and (0, x-1) in R:
num += 1
# Y负半轴
if x == -2 and (0, x+1) in R and (0, x-1) in R:
num += 1
print(num)
|