Python 只有最后一个点 AC 其他 WA 就离谱
查看原帖
Python 只有最后一个点 AC 其他 WA 就离谱
1005781
blsya23a2楼主2024/7/12 16:33
from copy import deepcopy as dc
a,m=int(input()),{}
for b in range(1,a+1):
    m[str(b)]=input().replace('0','').split()
c,c1={'1':1},{}
while c!=c1:
    c1=dc(c)
    for d in c1.keys():
        for e in m[d]:
            if e not in c.keys():
                c[e]=c1[d]+1
print(max(c.values()))
2024/7/12 16:33
加载中...