暂时
1 bool topo()
2 {
3 int count = 0 ;
4 while (!q.empty())
5 q.pop();
6 for (int i = 1; i <= n; i++)
7 if (!in[i])
8 q.push(i);
9 while (!q.empty())
10 {
11 int begin = q.front() ;
12 q.pop();
13 count ++ ;
14 for (int i = 0; i < course[begin].size(); i ++)
15 if (--in[course[begin][i]]==0)
16 q.push(course[begin][i]) ;
17 }
18 if(count == n)
19 return true;
20 else
21 return false;
22 }