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/ZAlgorithm.java

Depends on

Verified with

Code

package library;

import library.FastIO;

final class ZAlgorithm {
	// return the length of the longest list starting from S[i] which is also a prefix of S
	// O(|S|)
	public static final int[] cal(String s) { return cal(s.toCharArray()); }
	public static final int[] cal(char[] c) { return cal(FastIO.charToInt(c)); }
	public static final int[] cal(int[] a) {
		int len = a.length;
		int match[] = new int[len];
		match[0] = len;
		int i = 1;
		int j = 0;
		while(i < len) {
			while(i + j < len && a[j] == a[i + j]) j ++;
			match[i] = j;
			if(j == 0) { i ++; continue; }
			int k = 1;
			while(i + k < len && k + match[k] < j) { match[i + k] = match[k]; k ++; }
			i += k;
			j -= k;
		}
		return match;
	}
}
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