library_for_python

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

View the Project on GitHub Kazun1998/library_for_python

:heavy_check_mark: test_verify/yosupo_library_checker/Data_Structure/Segment_Tree.test.py

Depends on

Code

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

#==================================================
from Segment_Tree.Segment_Tree import *

import sys
input=sys.stdin.readline
write=sys.stdout.write

#==================================================
def verify():
    N,Q=map(int,input().split())
    Mod=998244353

    A=[0]*N
    for i in range(N):
        a,b=map(int,input().split())
        A[i]=(a,b)

    calc=lambda p,q:((p[0]*q[0])%Mod,(p[1]*q[0]+q[1])%Mod)
    S=Segment_Tree(A,calc,(1,0))

    Ans=[]
    for _ in range(Q):
        m,s,t,u=map(int,input().split())
        if m==0:
            S.update(s,(t,u))
        else:
            (alpha,beta)=S.product(s,t-1)
            Ans.append((alpha*u+beta)%Mod)

    write("\n".join(map(str,Ans)))

#==================================================
verify()
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.3/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.3/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page