There is an unknown sequence of integers $(a_ 0, \ldots, a_ {N - 1})$, process $Q$ queries.
t_i = 0 u_i v_i x_i: You are provided with information that $a_ u \equiv a_ v + x \pmod{998244353}$. This information is valid if it does not contradict any previously given valid information. If this information is valid, output $1$; otherwise, output $0$.
t_i = 1 u_i v_i: Based on the valid information provided so far, output the value of $a_ u - a_ v \bmod 998244353$ if it can be determined; otherwise, output $-1$.
$N$ $Q$
$\textrm{Query}_ 0$
$\textrm{Query}_ 1$
:
$\textrm{Query}_ {Q - 1}$
4 10 0 1 0 9 1 0 2 0 2 1 90 0 2 0 99 0 0 2 123 0 3 1 990 1 0 2 1 2 0 1 3 0 1 1 1
1 -1 1 1 0 1 998244254 99 999 0
| No. | Testdata Range | Score |
|---|