icpc-snippet

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

View the Project on GitHub EarthMessenger/icpc-snippet

:heavy_check_mark: verify/str/longest_common_substring.test.cpp

Depends on

Code

#define PROBLEM "https://judge.yosupo.jp/problem/longest_common_substring"

#include <array>

#include "lib/internal.hpp"
#include "lib/str/sa.hpp"

int main()
{
  std::string s, t;
  std::cin >> s >> t;

  auto st = s + "|" + t;
  auto [sa, rk] = suffix_array(st);
  auto h = calc_height(st, sa, rk);

  int n = st.size(), m = s.size();

  int len = 0;
  std::array<int, 4> ans{0, 0, m + 1, m + 1};
  for (int i = 0; i < n - 1; i++) {
    int p = sa[i], q = sa[i + 1];
    if (p > q) std::swap(p, q);
    if (p < m && q > m) {
      if (len < h[i]) {
        len = h[i];
        ans = {p, p + len, q, q + len};
      }
    }
  }

  std::cout << ans[0] << " " << ans[1] << " " << ans[2] - m - 1 << " "
            << ans[3] - m - 1 << std::endl;
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/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.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: lib/internal.hpp: line 4: #pragma once found in a non-first line
Back to top page