ответ:
n, m, t = map(int,
x = list(map(int,
def build(name):
if name in built:
pass
elif b[a.index(name)] == ["0"]:
built.append(name)
else:
for i in b[a.index(: ]:
if i not in built:
build(i)
a = []
b = []
built = []
for i in range(0, n):
a.append(
b.append(
for i in range(0, b.:
built.append(a[b.
a.pop(b.
b.pop(b.
[build(str(o)) for o in x]
print(len(built))
объяснение:
работает с e1, но в e2 выдает time limit exceeded на 57 тесте
m, n = map(int,
bank = []
bull = []
for i in range(m):
bank.append(list(map(int,
for i in range(n):
bull.append(list(map(int,
shoted = [true] * m
ns = [-1] * n
for j in range(m):
if bank[j][0] < = bull[i][0] < = bank[j][2] and bank[j][1] < = bull[i][1] < = bank[j][3] and shoted[j]:
shoted[j] = false
ns[i] = j + 1
break
for k in ns:
print(k, end=' ')
ответ:
n, m, t = map(int,
x = list(map(int,
def build(name):
if name in built:
pass
elif b[a.index(name)] == ["0"]:
built.append(name)
else:
for i in b[a.index(: ]:
if i not in built:
build(i)
built.append(name)
a = []
b = []
built = []
for i in range(0, n):
a.append(
b.append(
for i in range(0, b.:
built.append(a[b.
a.pop(b.
b.pop(b.
[build(str(o)) for o in x]
print(len(built))
объяснение:
ответ:
работает с e1, но в e2 выдает time limit exceeded на 57 тесте
объяснение:
m, n = map(int,
bank = []
bull = []
for i in range(m):
bank.append(list(map(int,
for i in range(n):
bull.append(list(map(int,
shoted = [true] * m
ns = [-1] * n
for i in range(n):
for j in range(m):
if bank[j][0] < = bull[i][0] < = bank[j][2] and bank[j][1] < = bull[i][1] < = bank[j][3] and shoted[j]:
shoted[j] = false
ns[i] = j + 1
break
for k in ns:
print(k, end=' ')