а: 2(м)-один моток а: 2-2-(м)-второй моток
Объяснение:
h,w = int(input().split())
c,p = int(input().split())
s = []
roadm = []
parks = []
cp = []
for i in range(1, h+1):
for j in range(1, w+1):
s.append([i,j])
for k in s:
if k[0]==1 or k[1]==1:
roadm.append(s.pop(k))
for t in s:
if t[0] == 2 or t[1] == 2:
cp.append(s.pop(t))
for y in s:
if y[0] == (f[0]+1 for f in cp) and y[1] == (f[1]+1 for f in cp) and y[0] == (f[0]-1 for f in cp) and y[1] == (f[1]-1 for f in cp):
parks.append(s.pop(y))
a = []
b = []
for o in s:
a.append(o[0])
b.append(o[1])
print(min(a))
print(min(b))
а: 2(м)-один моток а: 2-2-(м)-второй моток
Объяснение:
h,w = int(input().split())
c,p = int(input().split())
s = []
roadm = []
parks = []
cp = []
for i in range(1, h+1):
for j in range(1, w+1):
s.append([i,j])
for k in s:
if k[0]==1 or k[1]==1:
roadm.append(s.pop(k))
for t in s:
if t[0] == 2 or t[1] == 2:
cp.append(s.pop(t))
for y in s:
if y[0] == (f[0]+1 for f in cp) and y[1] == (f[1]+1 for f in cp) and y[0] == (f[0]-1 for f in cp) and y[1] == (f[1]-1 for f in cp):
parks.append(s.pop(y))
a = []
b = []
for o in s:
a.append(o[0])
b.append(o[1])
print(min(a))
print(min(b))