포럼
문제 R03597

S3. Palindromic Poster

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

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.

제약

Marks

The following table shows how the available 15 marks are
distributed:

Marks Bounds on \(N\) Bounds on \(M\) Bounds on \(R\) Bounds on \(C\)
2 marks \(2 \le N \le 2\,000\) \(2 \le M \le 2\,000\) \(R = 1\) \(C = 1\)
2 marks \(N = 2\) \(M = 2\) \(0 \le R \le N\) \(0 \le C \le M\)
4 marks \(N = 2\) \(2 \le M \le 2\,000\) \(0 \le R \le N\) \(0 \le C \le M\)
7 marks \(2 \le N \le 2\,000\) \(2 \le M \le 2\,000\) \(0 \le R \le N\) \(0 \le C \le M\)
입력 형식

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.

예제 1
입력
4 5 1 2
출력
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
출력
IMPOSSIBLE
설명

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

문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2023 Senior

평가 및 의견

S3. Palindromic Poster

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

S3. Palindromic Poster

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8