This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n,k=map(int,input().split())
disagree=[]
enemies=[]
for i in range(n):
s=set()
q=input().split()
for j in range(1,len(q)):
s.add(int(q[j]))
enemies.append([-int(q[0]),i])
disagree.append(s)
enemies=sorted(enemies)
def juntar(a,comun,disagree,tam,m,k):
for i in comun:
m=max(m,tam+1)
if(m==k):
break
m=juntar(i,comun&disagree[i],disagree,tam+1,m,k)
return m
m=1
for i in range(n):
a=enemies[i][1]
m=juntar(a,disagree[a],disagree,1,m,k)
if(m==k):
break
print(m)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |