This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub shun0923/competitive-programming-java-library
// verification-helper: PROBLEM https://yukicoder.me/problems/no/468
package library;
import library.Solver;
import library.AbstractGraph;
import library.TopologicalSort;
public class TopologicalSort_test extends Solver {
public static void main(final String[] args) { main(args, new TopologicalSort_test()); }
public void solve() {
int n = ni();
int m = ni();
var g = new WeightedListGraph(n, true);
for(int i = 0; i < m; i ++) g.add(ni(), ni(), nl());
long dist1[] = cal(n, g.nodes(), g.edges());
long dist2[] = cal(n, g.reverseNodes(), g.reverseEdges());
for(int i = 0; i < n; i ++) dist2[i] = dist1[0] - dist2[i];
int cnt = 0;
for(int i = 0; i < n; i ++) if(dist1[i] != dist2[i]) cnt ++;
prtln(dist1[0]+" "+cnt+"/"+n);
}
long[] cal(int n, WeightedNode[] nodes, WeightedNode edges) {
int sorted[] = TopologicalSort.sort(nodes, edges);
reverse(sorted);
long dist[] = new long[n];
dist[sorted[0]] = 0;
for(int i : sorted) {
for(WeightedEdge e : nodes[i]) {
dist[i] = max(dist[i], dist[e.target] + e.cost);
}
}
return dist;
}
}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.