{"problem":{"name":"G. Puzzling Language","description":{"content":"In this problem you will write a simple code generator for a 2D programming language derived from [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck). The code in this language is a rectangular grid","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF952G"},"statements":[{"statement_type":"Markdown","content":"In this problem you will write a simple code generator for a 2D programming language derived from [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck).\n\nThe code in this language is a rectangular grid of characters '.' and 'X'. The code is converted to a Brainfuck program as follows: the characters are read in the usual order (top to bottom, left to right), and each 'X' character is converted a Brainfuck instruction to be executed. The instruction is defined by the left, top and right neighbors of the 'X' character using the following conversion table:\n\n<center>![image](https://espresso.codeforces.com/3df07c064c0d1b9fa0c4174054f138ca4d252e02.png)</center>You are given a string. Output a program in the described language which prints this string.\n\nYou can download the language interpreter used for judging here: [https://assets.codeforces.com/rounds/952/puzzling-interpreter.cpp](https://assets.codeforces.com/rounds/952/puzzling-interpreter.cpp) (use C++11 to compile the code). Note several implementation details:\n\n*   The first step of the language interpretation is conversion to a Brainfuck program, which is then executed.\n*   The code must be rectangular, with all lines of the same length. It can have at most 10,000 lines and 10,000 columns, and can have at most 500,000 'X' characters.\n*   The code has toroidal topology, i.e. the 'X' on the first line will have top neighbor in the last line.\n*   Brainfuck interpreter has 30000 memory cells which store integers from 0 to 255 with increment/decrement done modulo 256.\n*   Console input (_,_ command) is allowed in Brainfuck code but has no effect when executed.\n\n## Input\n\nThe input consists of a single string of characters with ASCII codes between 33 ('!') and 122 ('z'), inclusive. The length of the string is between 1 and 10 characters, inclusive.\n\n## Output\n\nOutput a program in the described language which, when executed, will print the given message.\n\n[samples]\n\n## Note\n\nThe example corresponds to the following Brainfuck program:\n\n       -\n      >+<\n     >+++<\n    >+++++<\n   >+++++++<\n  >+++++++++<\n >+++++++++++<\n\n<             >\n.\n.\n.\n\nThe triangular block decrements the first memory cell and sets the value of the second memory cell to 36 - the ASCII code of '$' character. The next line after the triangular block moves the memory pointer to the second memory cell, and the next three lines print the '$' character three times.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"在本题中，你需要为一种源自 Brainfuck 的二维编程语言编写一个简单的代码生成器。\n\n该语言的代码是一个由字符 '.' 和 'X' 组成的矩形网格。代码按常规顺序（从上到下，从左到右）读取，每个 'X' 字符会被转换为一个要执行的 Brainfuck 指令。该指令由 'X' 字符的左、上和右邻居根据以下转换表定义：\n\n你被给定一个字符串。请输出一个上述语言的程序，该程序执行后会打印该字符串。\n\n你可以在此处下载用于评测的语言解释器：https://assets.codeforces.com/rounds/952/puzzling-interpreter.cpp（请使用 C++11 编译代码）。请注意以下实现细节：\n\n输入由一个字符串组成，其中字符的 ASCII 码在 33 ('!') 到 122 ('z') 之间（包含端点）。字符串长度在 1 到 10 之间（包含端点）。\n\n请输出一个上述语言的程序，该程序执行后会打印给定的消息。\n\n示例对应以下 Brainfuck 程序：\n\n三角形块将第一个内存单元减一，并将第二个内存单元的值设为 36 —— 即 '$' 字符的 ASCII 码。三角形块后的下一行将内存指针移动到第二个内存单元，接下来的三行将 '$' 字符打印三次。\n\n## Input\n\n输入由一个字符串组成，其中字符的 ASCII 码在 33 ('!') 到 122 ('z') 之间（包含端点）。字符串长度在 1 到 10 之间（包含端点）。\n\n## Output\n\n请输出一个上述语言的程序，该程序执行后会打印给定的消息。\n\n[samples]\n\n## Note\n\n示例对应以下 Brainfuck 程序：       -      >+<     >+++<    >+++++<   >+++++++<  >+++++++++< >+++++++++++<<             >...三角形块将第一个内存单元减一，并将第二个内存单元的值设为 36 —— 即 '$' 字符的 ASCII 码。三角形块后的下一行将内存指针移动到第二个内存单元，接下来的三行将 '$' 字符打印三次。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"Given a string $ s = s_1 s_2 \\dots s_n $ of length $ 1 \\leq n \\leq 10 $, where each $ s_i \\in \\{ \\text{ASCII } 33 \\text{ to } 122 \\} $, construct a rectangular grid of characters '.' and 'X' such that, when interpreted by the described 2D language (reading left-to-right, top-to-bottom, and mapping each 'X' to a Brainfuck instruction based on its left, top, and right neighbors via a fixed conversion table), the resulting Brainfuck program outputs $ s $.\n\nThe grid must be designed so that the executed Brainfuck program:\n- Initializes memory cells appropriately,\n- Sets the value of memory cells to the ASCII codes of $ s_1, s_2, \\dots, s_n $,\n- Outputs each character in sequence.\n\nThe conversion table for 'X' instructions based on neighbor patterns is fixed and known (but not explicitly provided here); the solution must produce a valid grid that, under this mapping, generates a Brainfuck program equivalent to the required output.\n\n**Objective:** Output such a grid (as a list of strings, each representing a row) with minimal dimensions, using only '.' and 'X'.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF952G","tags":["constructive algorithms"],"sample_group":[["$$$",".......X.......\n......XXX......\n.....XXXXX.....\n....XXXXXXX....\n...XXXXXXXXX...\n..XXXXXXXXXXX..\n.XXXXXXXXXXXXX.\n...............\nX.............X\nX..............\nX..............\nX.............."]],"created_at":"2026-03-03 11:00:39"}}