procon_lib_rs

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

View the Project on GitHub CoCo-Japan-pan/procon_lib_rs

:heavy_check_mark: verify/yosupo/zalgorithm_rolling_hash/src/main.rs

Depends on

Code

// verification-helper: PROBLEM https://judge.yosupo.jp/problem/zalgorithm

#![allow(non_snake_case)]
use proconio::{fastout, input, marker::Chars};
use rolling_hash::RollingHash;

#[fastout]
fn main() {
    input! {
        S: Chars,
    }
    let rh = RollingHash::new(&S, None);
    for i in 0..S.len() {
        // [i, i) ~ [i, S.len() + 1) で二分探索
        let mut left = i;
        let mut right = S.len() + 1;
        while right - left > 1 {
            let mid = (left + right) / 2;
            if rh.get_hash(i..mid) == rh.get_prefix_hash(mid - i) {
                left = mid;
            } else {
                right = mid;
            }
        }
        print!("{} ", left - i);
    }
}
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/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.13.9/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/rust.py", line 288, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page