시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 2 2 2 100.000%

문제

You may have heard of Conway’s Game of Life, which is a simple set of rules for cells on a grid that can produce incredibly complex configurations. In this problem we will deal with a simplified version of the game.

There is a one-dimensional circular strip of N cells. The cells are numbered from 1 to N in the order you would expect: that is, cell 1 and cell 2 are adjacent, cell 2 and cell 3 are adjacent, and so on up to cell N − 1, which is adjacent to cell N. Since the strip is circular, cell 1 is also adjacent to cell N.

Each cell is either alive (represented by a ‘1’) or dead (represented by a ‘0’). The cells change over a number of generations. If exactly one of a cell’s neighbours is alive in the current generation, then the cell will be alive in the next generation. Otherwise, the cell will be dead in the next generation.

Given the initial state of the strip, find the state after T generations.

입력

The first line will contain two space-separated integers N and T (3 ≤ N ≤ 100 000; 1 ≤ T ≤ 1015). The second line will contain a string consisting of exactly N characters, representing the initial configuration of the N cells. Each character in the string will be either ‘0’ or ‘1’. The initial state of cell i is given by the i-th character of the string. The character ‘1’ represents an alive cell and the character ‘0’ represents a dead cell.

출력

Output the string of N characters representing the final state of the cells, in the same format and order as the input.

제한

  • N ≤ 4000
  • T ≤ 10 000 000.

예제 입력 1

7 1
0000001

예제 출력 1

1000010

Cell 1 and cell N − 1 are adjacent to cell N, and thus are alive after one generation.

예제 입력 2

5 3
01011

예제 출력 2

10100

After one generation, the configuration becomes 00011.

After two generations, the configuration becomes 10111.