Library-Python

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

View the Project on GitHub Rin204/Library-Python

src/$tests/data_structure/SWAGBase_.test.py

Depends on

Code

# verification-helper: PROBLEM https://judge.yosupo.jp/problem/queue_operate_all_composite
from pathlib import Path
import sys

sys.path.append(str(Path(__file__).resolve().parent.parent.parent.parent))
from src.data_structure.SWAGBase_ import SWAGBase_


MOD = 998244353


class QueueOperateAllComposite(SWAGBase_):
    def ope(self, l, r):
        a = l >> 30
        b = l ^ (a << 30)
        c = r >> 30
        d = r ^ (c << 30)

        e = (a * c) % MOD
        f = (b * c + d) % MOD

        return (e << 30) | f

    def e(self):
        return 1 << 30


Q = int(input())
swag = QueueOperateAllComposite()

for _ in range(Q):
    query = list(map(int, input().split()))
    if query[0] == 0:
        swag.push((query[1] << 30) | query[2])
    elif query[0] == 1:
        swag.pop()
    else:
        res = swag.prod()
        a = res >> 30
        b = res ^ (a << 30)
        ans = (a * query[1] + b) % MOD
        print(ans)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py", line 81, in _render_source_code_stat
    bundled_code = language.bundle(
                   ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/python.py", line 108, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page