This documentation is automatically generated by online-judge-tools/verification-helper
// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/1549
use proconio::{fastout, input};
use wavelet_matrix::WaveletMatrix;
#[fastout]
fn main() {
input! {
n: usize,
a: [usize; n],
q: usize,
l_r_d: [(usize, usize, usize); q],
}
let wm = WaveletMatrix::new(&a);
for (l, r, d) in l_r_d {
let r = r + 1;
let pre = wm.prev_value(l..r, d);
let next = wm.next_value(l..r, d);
let ans = match (pre, next) {
(Some(pre), Some(next)) => (next - d).min(d - pre),
(Some(pre), None) => d - pre,
(None, Some(next)) => next - d,
(None, None) => unreachable!(),
};
println!("{}", ans);
}
}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