competitive-programming-java-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub shun0923/competitive-programming-java-library

:heavy_check_mark: library/GridBfs.java

Depends on

Verified with

Code

package library;

import java.util.*;
import library.FastIO;
import library.AbstractGrid;

final class GridBfs {
	// O(HW)
	public static final int[] dist(final BooleanGrids g, final BooleanGrid start) { return dist(g, start, null); }
	public static final int[] dist(final BooleanGrids g, final BooleanGrid start, final int[] prv) {
		int n = g.h * g.w;
		int dist[] = new int[n];
		Arrays.fill(dist, -1);
		boolean visited[] = new boolean[n];
		BooleanGrid dq[] = new BooleanGrid[n];
		int ptr = 0;
		int size = 0;
		if(prv != null) Arrays.fill(prv, -1);

		dist[start.i] = 0;
		visited[start.i] = true;
		dq[size ++] = start;
		while(ptr != size) {
			BooleanGrid crt = dq[ptr ++];
			for(int add = 1; add <= 4; add ++) {
				BooleanGrid next = g.next(crt, add);
				if(next == null || next.b) continue;
				if(!visited[next.i]) {
					dist[next.i] = dist[crt.i] + 1;
					visited[next.i] = true;
					dq[size ++] = next;
					if(prv != null) prv[next.i] = crt.i;
				}
			}
		}
		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.
Back to top page