{"problem":{"name":"Ternary Strings","description":{"content":"Given are integers $N$ and $L$. Find a tuple of $3N$ strings $(S_1,S_2,\\cdots,S_{3N})$ that satisfies all of the following conditions. *   $S_i$ is a string of length $L$ consisting of `0`, `1`, `2`.","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc127_b"},"statements":[{"statement_type":"Markdown","content":"Given are integers $N$ and $L$. Find a tuple of $3N$ strings $(S_1,S_2,\\cdots,S_{3N})$ that satisfies all of the following conditions.\n\n*   $S_i$ is a string of length $L$ consisting of `0`, `1`, `2`.\n    \n*   All $S_i$ are pairwise distinct.\n    \n*   For every $j$ ($1 \\leq j \\leq L$) and every $c=$`0`, `1`, `2`, the following holds.\n    *   For exactly $N$ of the strings $S_i$, the $j$\\-th character is $c$.\n*   Let $t$ be the lexicographically largest string among $S_1,S_2,\\cdots,S_{3N}$. $t$ for this tuple is the lexicographically smallest among all strings that $t$ can be.\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^4$\n*   $1 \\leq L \\leq 15$\n*   $3N \\leq 3^L$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $L$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc127_b","tags":[],"sample_group":[["2 2","00\n02\n11\n12\n20\n21\n\nThis Sample Output satisfies all conditions.\nFor example, there are two strings whose second character is `0`.\nAlso, we have $t=$`21` in this sample, and $t$ is never lexicographically smaller than this."]],"created_at":"2026-03-03 11:01:14"}}