아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Lots of Land

시간 제한1초메모리 제한1024 MB

요약
l×w 격자를 넓이가 같은 n개의 정수 변 직사각형으로 나누어 각각 다른 알파벳을 채우고, 불가능하면 impossible을 출력한다.
난이도

보통10점 중 6점

유형
구현, 완전 탐색, 수학, 백트래킹
정답자
아직 제출이 없습니다

문제

Farmer Robert has been running a very successful cereal farm for many years. Now he wants to diversify his business and get into growing potatoes. To this end, he has bought a new plot of land on which he plans to plant the potatoes. This field is a rectangle and is exactly ℓ\ell metres long and ww metres wide.

Since Robert is new to the potato business, he has initially purchased nn different potato varieties to try out in the first year. He plans to divide his plot of land into nn parts of equal area and plant one of the varieties on each. To make it easier for him to work the fields with his tractor, each new piece of land should itself be a rectangle and have integer side lengths. Help Robert to find a suitable division of his field.

입력

The input consists of:

  • One line with three integers ℓ,w,n\ell, w, n (1≤ℓ,w≤1001 \le \ell,w \le 100, 1≤n≤261 \le n \le 26), the length and width of Robert's field and the number of potato varieties.

출력

If there is no solution, output impossible. Otherwise output ℓ\ell lines, each with ww uppercase letters, describing a possible division of Robert's field. There should be the same number of occurrences of each of the first nn letters of the English alphabet, and for each letter, its occurrences should form a single rectangular region. If there is more than one solution, any one of them will be accepted.

예제3

  1. 예제 1

    입력
    4 4 4
    
    예상 출력
    AAAA
    BBCC
    BBCC
    DDDD
    
  2. 예제 2

    입력
    6 15 9
    
    예상 출력
    GGGGGBBBBBBBBBB
    GGGGGAAAAAAAAAA
    IIIIIIIIIIEEEEE
    FFFFFFFFFFEEEEE
    CCCCCDDDDDHHHHH
    CCCCCDDDDDHHHHH
    
  3. 예제 3

    입력
    100 100 26
    
    예상 출력
    impossible