409. Berland Flag

Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

The Berland is in trouble again. After the recent elections All-Berland Great Duma has divided into two coalitions: Blue-eyed coalition and Red-eyed coalition. On the independence day the following question was raised: what will the national flag look like? Both coalitions agreed that the flag should be a square of N2 x N2 cells, each of them painted blue of red. To make the flag acceptable for both coalitions, the following requirements must be held:
  • every row of the flag must contain exactly K blue cells
  • every column of the flag must contain exactly K blue cells
  • if we split the flag into squares of N x N cells (there will be N x N such squares), then every such square must contain exactly K blue cells. You are the chief programmers in Berland. So, making the flag model is your duty.
    First line of the input contains two integer numbers N and K (1 ≤ N ≤ 20, 0 ≤ KN2).
    Output description of the desired flag. Print N2 lines which consist of N2 characters
    , where
    means blue cell and
    means red cell. Output
    (without quotes), if there is no flag which satisfies both coalitions. If there are several solutions, output any of them.
    sample input
    sample output
    2 2

    sample input
    sample output
    3 1

  • Online Contester Team © 2002 - 2010. All rights reserved.