| 记录编号 | 
        35590 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        644.课程安排问题 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         Truth.Cirno | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.003 s  | 
    
    
        | 提交时间 | 
        2012-02-26 10:48:22 | 
        内存使用 | 
        0.27 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <cstdio>
using namespace std;
int way[101]={0},ans[101]={0};
bool map[101][101]={0};
int main(void)
{
	freopen("curriculum.in","r",stdin);
	freopen("curriculum.out","w",stdout);
	int i,j,n,m,c,temp;
	bool broken=false;
	scanf("%d",&n);
	c=0;
	for (i=1;i<=n;i++)
	{
		scanf("%d",&m);
		way[i]+=m;
		for (j=0;j<m;j++)
		{
			scanf("%d",&temp);
			map[temp][i]=true;
		}
	}
	while (c<n)
	{
		temp=0;
		for (i=1;i<=n;i++)
			if (way[i]==0)
			{
				way[i]--;
				ans[c]=i;
				c++;
				temp=i;
				break;
			}
		if (temp==0)
		{
			broken=true;
			break;
		}
		for (i=1;i<=n;i++)
			if (map[temp][i]==true)
			{
				map[temp][i]=false;
				way[i]--;
			}
	}
	if (broken&&c<n)
		printf("no");
	else
	{
		c--;
		for (i=0;i<c;i++)
			printf("%d ",ans[i]);
		printf("%d",ans[c]);
	}
	printf("\n");
	return(0);
}