Logo
(追記) (追記ここまで)

20764번 - Bonbons 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB833100.000%

문제

Ylva loves bonbons, probably more than anything else on this planet. She loves them so much that she made a large plate of $R \cdot C$ bonbons for her fikaraster ("Fikarast" is a Swedish word, meaning to take a break from work while enjoying coffee and pastries together with your colleagues.).

Ylva has a large wooden tray which can fit $R$ rows of $C$ bonbons per row, that she will put the bonbons on. Her bonbons have three different fillings: Nutella Buttercream, Red Wine Chocolate Ganache, and Strawberry Whipped Cream. Since Ylva is a master chocolatier, she knows that presentation is 90ドル\%$ of the execution. In particular, it looks very bad if two bonbons of the same color are adjacent to each other within a row or a column on the tray. We call an arrangement of bonbons where this is never the case a good arrangement.

Given the number of bonbons of each flavour, and the size of Ylva's tray, can you help her find a good arrangement of the bonbons, or determine that no such arrangement exists?

입력

The first line of input contains the two space-separated integers 2ドル \le R, C \le 1000$. The next line contains three non-negative space-separated integers $a, b, c$ -- the number of bonbons of the three flavours which Ylva has baked. It is guaranteed that $a + b + c = R \cdot C$. Both $R$ and $C$ will be even.

출력

If no good arrangement can be found, output impossible. Otherwise, output $R$ lines, each containing $C$ characters, representing a good arrangement. Each row should contain only characters A, B, C, depending on which flavour should be placed on a certain position. The number of A bonbons placed must be equal to $A,ドル and so on.

제한

예제 입력 1

4 4
10 3 3

예제 출력 1

impossible

예제 입력 2

4 4
6 5 5

예제 출력 2

ABCA
BCAB
CABC
ABCA

힌트

출처

Contest > Swedish Coding Cup > Sandvik Challenge 2020 D번

  • 문제를 만든 사람: Johan Sannemo
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /