# Point Set Range Composite

AC一覧

## Problem Statement問題文

Given a size $N$ sequence of linear functions $f_0, f_1, ..., f_{N-1}$. For all $i$, $f_i(x) = a_i x + b_i$. Process $Q$ queries as follows:

• 0 $p$ $c$ $d$: change $f_p \gets cx + d$.
• 1 $l$ $r$ $x$: print $f_{r-1}(f_{r-2}(...f_l(x))) \bmod 998244353$.

• 0 $p$ $c$ $d$: $f_p \gets cx + d$ に変更
• 1 $l$ $r$ $x$: $f_{r-1}(f_{r-2}(...f_l(x))) \bmod 998244353$ を出力する。

## Constraints制約

• $1 \leq N, Q \leq 500,000$
• $1 \leq a_i, c < 998244353$
• $0 \leq b_i, d, x < 998244353$
• $0 \leq p < N$
• $0 \leq l < r \leq N$

## Input入力

$N$ $Q$
$a_0$ $b_0$
$a_1$ $b_1$
:
$a_{N - 1}$ $b_{N - 1}$
$\textrm{Query}_0$
$\textrm{Query}_1$
:
$\textrm{Query}_{Q - 1}$


### # 1

5 5
1 2
3 4
5 6
7 8
9 10
1 0 5 11
1 2 4 12
0 1 13 14
1 0 4 15
1 2 5 16

14005
470
8275
5500


Timelimit: 5 secs

Before submitting, please confirm terms and conditions