verify/AI/waveletmatrix_test.nim

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

:heavy_check_mark: verify/AI/waveletmatrix_test.nim

Depends on

Code

# verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/ITP1_1_A
echo "Hello World"

import cplib/collections/waveletmatrix

let wm = initWaveletMatrix(@[3, 1, 4, 1, 5, 9, 2, 6])
assert wm.kth_smallest(0, 8, 0) == 1
assert wm.kth_smallest(0, 8, 3) == 3
assert wm.kth_smallest(2, 6, 1) == 4
assert wm.range_lowerbound(0, 8, 4) == 4
assert wm.range_upperbound(0, 8, 4) == 5
assert wm.range_lowerbound(1, 5, 2) == 2
assert wm.range_upperbound(1, 5, 1) == 2
let child = wm.get_child(3, 0, 8)
assert child == (l0: 0, r0: 7, l1: 7, r1: 8)

let boundary = initWaveletMatrix(@[0, 7, 3, 7])
assert boundary.range_lowerbound(0, 4, 8) == 4
assert boundary.range_lowerbound(1, 4, 9) == 3
assert boundary.range_lowerbound(0, 4, int.high) == 4
assert boundary.range_lowerbound(0, 4, -1) == 0

let empty = initWaveletMatrix(@[])
assert empty.range_lowerbound(0, 0, 10) == 0
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
Back to top page