P27705 [洛谷] [ICPC2024 Xi'an I] XOR Game
入门
题目描述

Problem Description

Alice and Bob are playing a game against each other.

In front of them is a multiset $\{a_i\}$ of non-negative integers and a single integer $x$. Each number in $a$ is either $0$ or $2^i$ where $0 \le i < k$.

The game is turn-based, with Alice going first. On each turn, a player selects an integer $p$ from $a$. The player then decides whether to apply the operation $x \gets x \oplus p$ (where $\oplus$ denotes bitwise XOR), and removes $p$ from $a$.

Alice aims to maximize $x$, while Bob aims to minimize $x$.

As an observer, you need to determine the final value of $x$. The size of $a$ is very large. Specifically, for each $0 \le i < k$, there are $b_i$ numbers in $a$ that are $2^i$, and there are $z$ numbers that are $0$.

Assuming both players play optimally, output the final value of $x$.

Input Format

The first line contains two integers $k$ and $z$ $(1 \le k \le 10^5, 0 \le z \le 10^9)$.

The next line contains $k$ integers, where the $i$-th integer is $b_{i-1}$ $(0 \le b_{i-1} \le 10^9)$.

Output Format

Output the answer in binary format. Ensure that the output consists of exactly $k$ digits, including leading zeros if necessary.

Sample Input and Output

Sample Input #1

1 0
3

Sample Output #1

1

Sample Input #2

2 0
2 1

Sample Output #2

11

Sample Input #3

2 0
2 2

Sample Output #3

00
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 0 3
样例输出
1