Hello everyone, I came up with this problem and I can't figure a solution out. I don't know if it has appeared before. ↵
You are given a matrix of size $n \times m$. Answer two types of queries: ↵
- $1$ $k$ $i_1$ $i_2$ $\dots$ $i_k$: Set the _active_ set to ${i_1, i_2, \dots, i_k}$. ↵
- $2$ $x$: What is the value of $a_{i_1, x} + a_{i_2, x} + \dots + a_{i_k, x}$, where $i_1, i_2, \dots, i_k$ are the current elements in the _active_ set? ↵
There are less than $n$ queries of type 1, and less than $m$ queries of type 2 between a pair of queries of type 1. ↵
1 \leq n, m \leq 2000$, however solutions with any reasonable complexity are welcome. ↵
Also, if a query of type 1 appears for the $i$-th time, $1 \leq k \leq i.$
You are given a matrix of size $n \times m$. Answer two types of queries: ↵
- $1$ $k$ $i_1$ $i_2$ $\dots$ $i_k$: Set the _active_ set to ${i_1, i_2, \dots, i_k}$. ↵
- $2$ $x$: What is the value of $a_{i_1, x} + a_{i_2, x} + \dots + a_{i_k, x}$, where $i_1, i_2, \dots, i_k$ are the current elements in the _active_ set? ↵
There are less than $n$ queries of type 1, and less than $m$ queries of type 2 between a pair of queries of type 1. ↵
1 \leq n, m \leq 2000$, however solutions with any reasonable complexity are welcome. ↵
Also, if a query of type 1 appears for the $i$-th time, $1 \leq k \leq i.$