library

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

View the Project on GitHub zer0-star/library

:heavy_check_mark: test/nim/lazy_test.nim

Back to top page

Depends on

Code

# verify-helper: PROBLEM https://judge.yosupo.jp/problem/range_affine_range_sum

include nim/segt/lazy

include nim/utils/base

include nim/math/modint

const MOD = 998244353

type
  mi = ModInt[MOD]

input:
  (N, Q): int
  a: seq[int, (it.initModInt, 1.initModInt)]

var
  segt = initLazySegT[(mi, mi), (mi, mi)](
    a,
    (((mi, mi), (mi, mi)) -> (mi, mi)) => (i0[0] + i1[0], i0[1] + i1[1]),
    (((mi, mi), (mi, mi)) -> (mi, mi)) => (i1[0] * i0[0] + i1[1] * i0[1], i0[1]),
    (((mi, mi), (mi, mi)) -> (mi, mi)) => (i0[0] * i1[0], i0[1] * i1[0] + i1[1]),
    (initModInt(0), initModInt(1)),
    (initModInt(1), initModInt(0))
  )

for _ in range(Q):
  let
    tmp = stdin.readLine.split.map(parseInt)
  if tmp[0] == 0:
    segt.updateRange(tmp[1], tmp[2], (initModInt(tmp[3]), initModInt(tmp[4])))
  else:
    echo segt.fold(tmp[1], tmp[2])[0]

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/onlinejudge_verify/docs.py", line 349, in write_contents
    bundled_code = language.bundle(self.file_class.file_path, basedir=pathlib.Path.cwd())
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/onlinejudge_verify/languages/nim.py", line 86, in bundle
    raise NotImplementedError
NotImplementedError

Back to top page