This documentation is automatically generated by online-judge-tools/verification-helper
# verification-helper: PROBLEM https://judge.yosupo.jp/problem/longest_common_substring
include cplib/str/hash_string
{.checks:off.}
import algorithm,sequtils,strutils
import atcoder/string
var S = stdin.readLine()
var T = stdin.readLine()
var SA = suffix_array((S & '$' & T))
var X = (S & '$' & T).initRollingHash()
var tmp : seq[RollingHash]
for i in 0..<len(X):
tmp.add(X[SA[i]..<len(X)])
var ans = 0
var a = 0
var b = 0
var c = 0
var d = 0
for i in 0..<(len(X)-1):
if (tmp[i].l in 0..<len(S) and tmp[i+1].l notin 0..<len(S)) or (tmp[i+1].l in 0..<len(S) and tmp[i].l notin 0..<len(S)):
var lcp = LCP(tmp[i],tmp[i+1])
if ans < lcp:
ans = lcp
if tmp[i].l in 0..<len(S):
a = tmp[i].l
b = tmp[i].l+lcp
c = tmp[i+1].l-len(S)-1
d = tmp[i+1].l+lcp-len(S)-1
else:
a = tmp[i+1].l
b = tmp[i+1].l+lcp
c = tmp[i].l-len(S)-1
d = tmp[i].l+lcp-len(S)-1
echo a," ",b," ",c," ",d
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.12/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 "/home/runner/.local/lib/python3.12/site-packages/onlinejudge_verify/languages/nim.py", line 86, in bundle
raise NotImplementedError
NotImplementedError