{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e由于中国人口众多,公共交通非常重要。公交车是传统公共交通系统中的重要交通方式。即使在现在,它仍然扮演着重要的角色。\u003cbr\u003e城市X的公交系统非常奇特。与其他城市的系统不同,车票的费用是根据两个站点之间的距离计算的。以下是描述距离和费用之间关系的列表。\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/0e82a72235091aeb4b817823246cb7f7?v\u003d1715052173\"\u003e\u003c/center\u003e\u003cbr\u003e\u003cbr\u003e你的邻居是一个非常吝啬的人。他请你帮他计算他列出的两个站点之间的最低费用。你能帮他解决这个问题吗?\u003cbr\u003e为了简化这个问题,你可以假设所有站点都位于一条直线上。我们使用x坐标来描述站点的位置。\u003cbr\u003e\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入包含多个测试用例。首先是一个数字,表示测试用例的数量。测试用例不超过20个。\u003cbr\u003e每个测试用例包含第一行的八个整数,分别为L1、L2、L3、L4、C1、C2、C3、C4,每个数字都是非负且不大于1,000,000,000。你可以假设L1≤L2≤L3≤L4。\u003cbr\u003e接下来是两个整数n和m,表示站点数和问题数。接下来的n行中,每行包含一个整数,表示第i个站点的x坐标。接下来的m行中,每行包含两个整数,表示起点和目的地。\u003cbr\u003e在所有问题中,起点将不同于目的地。\u003cbr\u003e对于每个测试用例,2≤N≤100,0≤M≤500,每个x坐标在-1,000,000,000和1,000,000,000之间,且没有两个x坐标会有相同的值。\u003cbr\u003e"}},{"title":"输出","value":{"format":"HTML","content":"对于每个问题,如果两个站点可达,则打印它们之间的最低费用。否则,打印“站点X和站点Y不可达。” 使用示例中的格式。\u003cbr\u003e"}},{"title":"示例","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\u003e2\r\n1 2 3 4 1 3 5 7\r\n4 2\r\n1\r\n2\r\n3\r\n4\r\n1 4\r\n4 1\r\n1 2 3 4 1 3 5 7\r\n4 1\r\n1\r\n2\r\n3\r\n10\r\n1 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\r\nThe minimum cost between station 1 and station 4 is 3.\r\nThe minimum cost between station 4 and station 1 is 3.\r\nCase 2:\r\nStation 1 and station 4 are not attainable.\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}