Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0166 - CLASS

  Dr. Strange is a really strange lecturer. Each lecture he calculates class fullness and if it is small, he decreases all semester grades by one. So the students want to maximize the class fullness.

   The class fullness is the minimum of row fullness and column fullness. The column fullness is the maximum number of students in a single column and therow fullness is the maximum number of students in a single row.

   For example there are 16 students shown on the left picture (occupied desks are darkened). The row fullness of this arrangement is 5 (the 4-th row) and thecolumn fullness is 3 (the 1-st, the 3-rd, the 5-th or the 6-th columns). So, the class fullness is 3. But if the students rearrange as shown on the right picture then the column fullness will become 4 (the 5-th column), and so the class fullness will also become 4.

   The students of Dr. Strange need to know the arrangement that maximizes class fullness so they ask you to write a program that calculates it for them.

Input

   The first line of the input file contains three integer numbers: nr and c (1  rc  1001  n  r × c.) — number of students, rows and columns in the class.

Output

   The first line of the output file must contain a single integer number — the maximum possible class fullness.

   The following r lines must contain the optimal student arrangement. Each line must contain a description of a single row. Row description is a line of ccharacters either "." or "#", where "." denotes an empty desk, and "#" denotes an occupied one. If there are multiple optimal arrangements, output any one.

Examples

stdin

stdout

1

16 4 6
4
.####.
#..###
#...##
###.##

 


Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-04-09
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Northern QF 2008.C

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.