{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e在一条长度为$$$n$$$的土地上有$$$k$$$台空调:第$$$i$$$台空调放置在单元格$$$a_i$$$($$$1 \\le a_i \\le n$$$)。不能在同一单元格放置两台或更多空调(即所有$$$a_i$$$都是不同的)。\u003c/p\u003e\u003cp\u003e每台空调由一个参数特征:温度。第$$$i$$$台空调的温度设置为$$$t_i$$$。\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/950bc089b1b5c73deb78987d38b04bc0?v\u003d1708220576\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003cspan class\u003d\"tex-font-size-small\"\u003e长度为$$$n\u003d6$$$的土地示例,其中$$$k\u003d2$$$、$$$a\u003d[2,5]$$$和$$$t\u003d[14,16]$$$。\u003c/span\u003e \u003c/center\u003e\u003cp\u003e对于每个单元格$$$i$$$($$$1 \\le i \\le n$$$),可以通过公式$$$$$$\\min_{1 \\le j \\le k}(t_j + |a_j - i|),$$$$$$计算单元格 $$$i$$$ 的温度,\u003c/p\u003e\u003cp\u003e其中$$$|a_j - i|$$$表示差值$$$a_j - i$$$的绝对值。\u003c/p\u003e\u003cp\u003e换句话说,单元格$$$i$$$中的温度等于空调 $j$ 的温度再加上它到单元格$$$i$$$的距离的最小值。\u003c/p\u003e\u003cp\u003e让我们看一个例子。假设$$$n\u003d6, k\u003d2$$$,第一台空调放在单元格$$$a_1\u003d2$$$,温度设置为$$$t_1\u003d14$$$,第二台空调放在单元格$$$a_2\u003d5$$$,温度设置为$$$t_2\u003d16$$$。在这种情况下,单元格中的温度为:\u003c/p\u003e\u003col\u003e \u003cli\u003e 单元格$$$1$$$中的温度为:$$$\\min(14 + |2 - 1|, 16 + |5 - 1|)\u003d\\min(14 + 1, 16 + 4)\u003d\\min(15, 20)\u003d15$$$; \u003c/li\u003e\u003cli\u003e 单元格$$$2$$$中的温度为:$$$\\min(14 + |2 - 2|, 16 + |5 - 2|)\u003d\\min(14 + 0, 16 + 3)\u003d\\min(14, 19)\u003d14$$$; \u003c/li\u003e\u003cli\u003e 单元格$$$3$$$中的温度为:$$$\\min(14 + |2 - 3|, 16 + |5 - 3|)\u003d\\min(14 + 1, 16 + 2)\u003d\\min(15, 18)\u003d15$$$; \u003c/li\u003e\u003cli\u003e 单元格$$$4$$$中的温度为:$$$\\min(14 + |2 - 4|, 16 + |5 - 4|)\u003d\\min(14 + 2, 16 + 1)\u003d\\min(16, 17)\u003d16$$$; \u003c/li\u003e\u003cli\u003e 单元格$$$5$$$中的温度为:$$$\\min(14 + |2 - 5|, 16 + |5 - 5|)\u003d\\min(14 + 3, 16 + 0)\u003d\\min(17, 16)\u003d16$$$; \u003c/li\u003e\u003cli\u003e 单元格$$$6$$$中的温度为:$$$\\min(14 + |2 - 6|, 16 + |5 - 6|)\u003d\\min(14 + 4, 16 + 1)\u003d\\min(18, 17)\u003d17$$$。 \u003c/li\u003e\u003c/ol\u003e\u003cp\u003e对于从$$$1$$$到$$$n$$$的每个单元格,找到其中的温度。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$q$$$($$$1 \\le q \\le 10^4$$$) —— 输入中的测试用例数。然后是测试用例。在每个测试用例之前,有一行空行。\u003c/p\u003e\u003cp\u003e每个测试用例包含三行。第一行包含两个整数$$$n$$$($$$1 \\le n \\le 3 \\cdot 10^5$$$)和$$$k$$$($$$1 \\le k \\le n$$$) —— 土地条的长度和空调数量。\u003c/p\u003e\u003cp\u003e第二行包含$$$k$$$个整数$$$a_1, a_2, \\ldots, a_k$$$($$$1 \\le a_i \\le n$$$) —— 空调在土地条上的位置。\u003c/p\u003e\u003cp\u003e第三行包含$$$k$$$个整数$$$t_1, t_2, \\ldots, t_k$$$($$$1 \\le t_i \\le 10^9$$$) —— 空调的温度。\u003c/p\u003e\u003cp\u003e保证所有测试用例中$$$n$$$的总和不超过$$$3 \\cdot 10^5$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,输出用空格分隔的$$$n$$$个整数:单元格中的空气温度。\u003c/p\u003e"}},{"title":"示例1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n\n6 2\n2 5\n14 16\n\n10 1\n7\n30\n\n5 5\n3 1 4 2 5\n3 1 4 2 5\n\n7 1\n1\n1000000000\n\n6 3\n6 1 3\n5 5 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e15 14 15 16 16 17 \n36 35 34 33 32 31 30 31 32 33 \n1 2 3 4 5 \n1000000000 1000000001 1000000002 1000000003 1000000004 1000000005 1000000006 \n5 6 5 6 6 5 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}