标签:class blog code ext 2014 html
bool Topo() { int sum = 0; while(1) { queue <int> Q; for(int i = 1; i <= n; i++) if(!in[i]) Q.push(i); sum += Q.size(); if(sum == n) return true; if(!Q.size()) return false; while(!Q.empty()) { int u = Q.front(); Q.pop(); in[u]--; for(int v = first[u]; v != -1; v = e[v].next) { in[e[v].v]--; } } } }
标签:class blog code ext 2014 html
原文地址:http://blog.csdn.net/u011686226/article/details/29567349