fork download
  1. boolean topological_sort(){
  2. boolean Cycle;
  3. for(int i = 1;i <= N;i ++){
  4. Cycle = dfs(i);
  5. if(Cycle)return false;
  6. }
  7. for(int i = 1;i <= n;i ++){
  8. Numbers[Stack.pop()] = i;
  9. }
  10. return true;
  11. }
  12. boolean dfs(int v){
  13. if(Color[v] == 1)return true;
  14. if(Color[v] == 2)return false;
  15. Color[v] = 1;
  16. for(int i = 0;i < Edges[v].size();i ++){
  17. if(dfs(Edges[v].get(i)))return true;
  18. }
  19. Stack.push(v);
  20. Color[v] = 2;
  21. return false;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: 'boolean' does not name a type
 boolean topological_sort(){
 ^
prog.cpp:12:3: error: 'boolean' does not name a type
   boolean dfs(int v){
   ^
stdout
Standard output is empty