ls2128606 @ 2022-08-06 16:13:02
#include<bits/stdc++.h>
using namespace std;
int n,m,a,h,book[10010],book1;
int edge[1010][1010];
int main ()
{book[0]=1;
cin>>n>>m;
for(int i=1;i<=m;++i){
cin>>edge[i][0];
for(int j=1;j<=edge[i][0];++j)
{
cin>>a;
edge[i][a]=1;
h=max(a,h);}
for(int i=1;i<=m;++i)
{
for(int j=1;j<=h;++j)
{if(!edge[i][j])
{for(int k=1;k<=i;++k)
{
book1=0;
if(!edge[k][j]&&book[k]>book1)
{
book1=book[k];
}
}
if(!book1){
book[i]=book1+1;
break;
}
}
}
}
}
cout<<book[m]+1;
return 0;
}
大佬求助
by Cerisier @ 2022-08-06 17:15:02
我很担心楼主的精神状态
by rsy_ @ 2022-12-04 18:25:26
@HLK_ZX +1