#P8763. Binary String Transformation
Binary String Transformation
Binary String Transformation
Given a binary string \( s = s_{1}s_{2}\cdots s_{n} \) consisting of characters '0' and '1', you are to perform a transformation on the string repeatedly.
The transformation is defined as follows:
$$ \begin{aligned} &s'_{1} = s_{1},\\ &s'_{i} = s_{i-1} \oplus s_{i} \quad \text{for } 2 \le i \le n, \end{aligned} $$where \( a \oplus b \) denotes the bitwise XOR operation (i.e. the result is 0 if \( a = b \) and 1 if \( a \neq b \)).
You will be given an integer \( t \), and you must determine the state of the string after applying the transformation exactly \( t \) times.
inputFormat
The first line contains two integers \( n \) and \( t \) where \( n \) is the length of the binary string and \( t \) is the number of transformations to apply.
The second line contains a binary string of length \( n \) composed only of the characters '0' and '1'.
outputFormat
Output the binary string after applying the transformation \( t \) times.
sample
3 1
011
010
</p>