{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"给定n个k位正整数,请你按照相同的重排序规则对这些正整数的各位进行重新排序,使得重新排序后的最大数和最小数之间的差值最小。例如:给定3个3位整数:010、909、012,如果将第1位和第2位进行交换实现重排序,则这三个数字的对应位都需要进行交换,交换后得到100、099、102,重排序之后得到的最大数为102,最小数为99,它们对应的差值3最小。"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e输入数据的第一行包含两个整数n和k(1\u003c\u003dn, k\u003c\u003d8)。接下来的n行,每行为一个k位的正整数。本题允许初始数据和重排序之后的数据中含有前置0。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e请输出n个数据按照相同规则重排序之后得到的最大数和最小数之间的最小差值。\u003c/p\u003e"}},{"title":"样例","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e \n \u003cdiv class\u003d\"input\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输入样例1\n \u003c/div\u003e \n \u003cpre\u003e6 4\u003cbr\u003e5237\u003cbr\u003e2753\u003cbr\u003e7523\u003cbr\u003e5723\u003cbr\u003e5327\u003cbr\u003e2537\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"output\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输出样例1\n \u003c/div\u003e \n \u003cpre\u003e2700\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"input\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输入样例2\n \u003c/div\u003e \n \u003cpre\u003e3 3\u003cbr\u003e010\u003cbr\u003e909\u003cbr\u003e012\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"output\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输出样例2\n \u003c/div\u003e \n \u003cpre\u003e3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"input\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输入样例3\n \u003c/div\u003e \n \u003cpre\u003e7 5\u003cbr\u003e50808\u003cbr\u003e36603\u003cbr\u003e37198\u003cbr\u003e44911\u003cbr\u003e29994\u003cbr\u003e42543\u003cbr\u003e50156\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"output\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n 输出样例3\n \u003c/div\u003e \n \u003cpre\u003e20522\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}