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

28314번 - Palindromic Poster 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB45171436.842%

문제

Ryo and Kita are designing a new poster for Kessoku Band. After some furious brainstorming, they came to the conclusion that the poster should come in the form of a 2-D grid of lowercase English letters (i.e. a to z), with $N$ rows and $M$ columns.

Furthermore, it is known that Ryo and Kita both have peculiar tastes in palindromes. Ryo will only be satisfied with the poster if exactly $R$ of its rows are palindromes, and Kita will only be satisfied with the poster if exactly $C$ of its columns are palindromes. Can you design a poster that will satisfy both Ryo and Kita, or determine that it is impossible to do so?

Note: A string is considered a palindrome if it is the same when read forwards and backwards. For example, kayak and bb are palindromes, whereas guitar and live are not.

입력

The first and only line of input consists of 4ドル$ space-separated integers $N,ドル $M,ドル $R,ドル and $C$.

출력

If it is impossible to design a poster that will satisfy both Ryo and Kita, output IMPOSSIBLE on a single line.

Otherwise, your output should contain $N$ lines, each consisting of $M$ lowercase English letters, representing your poster design. If there are multiple possible designs, output any of them.

제한

  • 2ドル \le N \le 2,000円$
  • 2ドル \le M \le 2,000円$
  • 0ドル \le R \le N$
  • 0ドル \le C \le M$

예제 입력 1

4 5 1 2

예제 출력 1

union
radar
badge
anime

In the given design, only the second row (namely radar) and the second and third columns (namely naan and iddi) are palindromes. Since exactly $R = 1$ of the rows and $C = 2$ of the columns are palindromes, this is an acceptable design.

예제 입력 2

2 2 2 1

예제 출력 2

IMPOSSIBLE

In this case, it can be proven that it is impossible to satisfy both Ryo and Kita.

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2023 > CCC 2023 Senior Division 3번

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

출처

대학교 대회

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

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