QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 256 MB Points totaux : 100 Hackable ✓

#4256. Maximum XOR Sum

Statistiques
$\newcommand\xor{\mathbin{\mathrm{xor}}}$

I have a sequence $a_1, a_2, \dots, a_n$, where each $a_i$ is a non-negative integer less than $2^m$.

Please implement three types of operations as described below:

  • $1$ $x$ $y$ $w$: For all $x \leq i \leq y$, update $a_i$ to $a_i \xor w$, where $w$ is a non-negative integer less than $2^m$.
  • $2$ $x$ $y$ $w$: For all $x \leq i \leq y$, update $a_i$ to $w$, where $w$ is a non-negative integer less than $2^m$.
  • $3$: Choose a subset of numbers from $a_1, a_2, \dots, a_n$ such that their XOR sum is maximized. Output this maximum value.

Here, $\xor$ denotes the bitwise XOR operation, and the XOR sum of $x_1, x_2, \dots, x_l$ is defined as $x_1 \xor x_2 \xor \dots \xor x_l$.

Input

The first line contains three positive integers $n, m, q$.

The next $n$ lines contain the initial values of $a_1, a_2, \dots, a_n$.

The next $q$ lines each describe an operation. The format is as described above. It is guaranteed that $1 \leq x \leq y \leq n$.

$a_1, \dots, a_n$ and $w$ are all represented as $m$-bit binary strings. The leftmost bit is the most significant bit, and the rightmost bit is the least significant bit. If the number has fewer than $m$ bits, it is padded with $0$s on the left.

Output

For each operation of type $3$, output an $m$-bit binary string representing the binary representation of the answer.

Examples

Input 1

3 4 7
0000
0011
0110
3
1 2 3 0010
3
2 1 2 0010
3
2 1 3 0000
3

Output 1

0110
0101
0110
0000

Constraints

Test Case ID $n$ $m$ $q$ Special Constraints
1$= 10$$= 10$$= 1000$None
2$= 500$$= 500$$= 10$
3$= 120$$= 120$$= 120$
4$= 2000$$= 2000$$= 10$
5$= 1800$$= 1800$$= 1800$$x = y$ for operations 1 and 2
6Only operations 1 and 3
7Only operations 2 and 3
8$=1500$$=1500$$=1500$None
9$=1800$$=1800$$=1800$
10$=2000$$=2000$$=2000$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.