k = int(input())
pair = int(input())
num=[]
checkPoint = [0]* (k+1)
def travel(a, v, checkPoint):
# for i in num[v][k]:
# # for j in num[v][v]:
# # if j not in checkPoint:
# # checkPoint[i] = 1
# # travel(num, j, checkPoint)
for i in range(1, v):
if num[a][i] == 1 and checkPoint[i] == 0:
checkPoint[i] = 1
travel(i, v, checkPoint)
for i in range(k+1):
v = []
for j in range(k+1):
v.append(0)
num.append(v)
for i in range(pair):
v = input().split()
vx = int(v[0])
vy = int(v[1])
num[vx][vy] += 1
num[vy][vx] += 1
for i in range(1, pair+2):
for j in range(1, pair+2):
print(num[i][j], end=' ')
print()
travel(1, pair+2, checkPoint)
print(len(checkPoint)/2)
print(checkPoint)
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
220209
220209
댓글 0개
좋아요
댓글(0)
bottom of page