#P12012. Disjoint Subset Cube Query
Disjoint Subset Cube Query
Disjoint Subset Cube Query
You are given a sequence \(a_1, a_2, \dots, a_n\) where each \(a_i\) is an integer in the range \([0, v-1]\). You need to process \(m\) operations on this sequence. The operations are of two types:
- Type 1 (Query): Given an interval \([l, r]\), determine whether it is possible to choose two nonempty, disjoint sets of indices \(X\) and \(Y\) (with \(X \cap Y = \emptyset\) and \(X, Y \subseteq \{l, l+1, \dots, r\}\)) such that they satisfy the following condition:
\[
\sum_{i\in X}(a_i+1)=\sum_{j\in Y}a_j.
\]
If such subsets exist, output
Yuno
; otherwise, outputYuki
for that query. - Type 2 (Update): Given an interval \([l, r]\), update each \(a_i\) for \(l \le i \le r\) as follows: \[ a_i = a_i^3 \bmod v. \]
Note that the indices of the sequence are 1-indexed.
inputFormat
The first line contains three integers \(n\), \(m\), and \(v\). The second line contains \(n\) integers representing the initial sequence \(a_1, a_2, \dots, a_n\). Each of the next \(m\) lines describes an operation. For an operation, the first integer is the type:
- If the first integer is 1, it is a query. It is followed by two integers \(l\) and \(r\).
- If the first integer is 2, it is an update. It is followed by two integers \(l\) and \(r\), and you must update \(a_l, a_{l+1}, \dots, a_r\) accordingly.
outputFormat
For each Type 1 operation (query), output a single line containing either Yuno
or Yuki
depending on whether or not the required subsets exist.
sample
4 3 5
0 1 2 3
1 1 4
2 2 3
1 1 4
Yuno
Yuno
</p>