This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub shun0923/competitive-programming-java-library
package library;
import java.util.*;
import library.FastIO;
import library.AbstractGraph;
final class TopologicalSort {
// O(E+V)
public static final <Edge extends AbstractEdge<Edge>> int[] sort(AbstractGraph<? extends AbstractNode<Edge>, Edge> g) { return sort(g.nodes(), g.edges()); }
public static final <Edge extends AbstractEdge<Edge>> int[] sort(AbstractNode<Edge>[] nodes, AbstractNode<Edge> edges) {
int numNode = nodes.length;
int dq[] = new int[numNode];
int ptr = 0;
int size = 0;
int deg[] = new int[numNode];
Arrays.fill(deg, 0);
for(Edge e : edges) deg[e.target] ++;
for(int i = 0; i < numNode; i ++) if(deg[i] == 0) dq[size ++] = i;
int ans[] = new int[numNode];
int idx = 0;
while(ptr != size) {
int crt = dq[ptr ++];
ans[idx ++] = crt;
for(Edge e : nodes[crt]) if(-- deg[e.target] == 0) dq[size ++] = e.target;
}
return idx == numNode ? ans : null;
}
}Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/user_defined.py", line 71, in bundle
return subprocess.check_output(shlex.split(command))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['false']' returned non-zero exit status 1.