{"problem":{"name":"[CCC 2023 S3] Palindromic Poster","description":{"content":"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\\text{-D}$ grid of lowercase Engl","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P4"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9326"},"statements":[{"statement_type":"Markdown","content":"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\\text{-D}$ grid of lowercase English letters (i.e. `a` to `z`), with $N$ rows and $M$ columns.\n\nFurthermore, 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?\n\n**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.\n\n## Input\n\nThe first and only line of input consists of $4$ space-separated integers $N, M, R$, and $C$.\n\nThe following table shows how the available $15$ marks are distributed.\n\n| Marks | Bounds on $N$ | Bounds on $M$ | Bounds on $R$ | Bounds on $C$ |\n| :-----------: | :-----------: | :-----------: | :-----------: | :-----------: |\n| $2$ marks | $2 \\leq N \\leq 2000$ | $2 \\leq M \\leq 2000$ | $R = 1$ | $C = 1$ |\n| $2$ marks | $N = 2$ | $M = 2$ | $0 \\leq R \\leq N$ | $0 \\leq C \\leq M$ |\n| $4$ marks | $N = 2$ | $2 \\leq M \\leq 2000$ | $0 \\leq R \\leq N$ | $0 \\leq C \\leq M$ |\n| $7$ marks | $2 \\leq N \\leq 2000$ | $2 \\leq M \\leq 2000$ | $0 \\leq R \\leq N$ | $0 \\leq C \\leq M$ |\n\n## Output\n\nIf it is impossible to design a poster that will satisfy both Ryo and Kita, output `IMPOSSIBLE` on a single line.\n\nOtherwise, 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 ofthem.\n\n[samples]\n\n## Note\n\nExplanation of Output for Sample Input $1$：\n\nIn 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\ncolumns are palindromes, this is an acceptable design.\n\nExplanation of Output for Sample Input $2$：\n\nIn this case, it can be proven that it is impossible to satisfy both Ryo and Kita.\n\n**本题采用捆绑测试**：\n\n- Subtask 1（2 points）：数据保证 $2 \\leq N \\leq 2000$，$2\\leq M\\leq 2000$，$R = 1$，$C = 1$。\n\n- Subtask 2（2 points）：数据保证 $N = 2$，$M = 2$，$0\\leq R\\leq N$，$0\\leq C\\leq M$。\n\n- Subtask 3（4 points）：数据保证 $N = 2$，$2\\leq M \\leq2000$，$0\\leq R\\leq N$，$0\\leq C\\leq M$。\n\n- Subtask 4（7 points）：数据保证 $2\\leq N\\leq 2000$，$2\\leq M \\leq2000$，$0\\leq R\\leq N$，$0\\leq C\\leq M$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9326","tags":["模拟","字符串","2023","Special Judge","CCC（加拿大）","构造","分类讨论"],"sample_group":[["4 5 1 2","union\nradar\nbadge\nanime"],["2 2 2 1","IMPOSSIBLE"]],"created_at":"2026-03-03 11:09:25"}}