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

Depends on

Verified with

Code

package library;

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

final class LcpArray {
	// O(|S|)
	public static final int[] cal(String s) { return cal(s, SuffixArray.cal(s)); }
	public static final int[] cal(char[] c) { return cal(c, SuffixArray.cal(c)); }
	public static final int[] cal(int[] a) { return cal(a, SuffixArray.cal(a)); }
	public static final int[] cal(String s, int[] sa) { return cal(s.toCharArray(), sa); }
	public static final int[] cal(char[] c, int[] sa) { return cal(FastIO.charToInt(c), sa); }
	public static final int[] cal(int[] a, int[] sa) {
		int n = a.length;
		int rnk[] = new int[n];
		for(int i = 0; i < n; i ++) rnk[sa[i]] = i;
		int[] lcp = new int[n - 1];
		int h = 0;
		for(int i = 0; i < n; i ++) {
			if(h > 0) h --;
			if(rnk[i] == 0) continue;
			int j = sa[rnk[i] - 1];
			for(; j + h < n && i + h < n; h ++) {
				if(a[j + h] != a[i + h]) break;
			}
			lcp[rnk[i] - 1] = h;
		}
		return lcp;
	}
}
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