{"trustable":false,"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":"MD","content":"由于中国人口众多,公共交通非常重要。 公交车是传统公交系统中一种重要的交通方式。 即使在现在,它仍在发挥重要作用。lfgg就很喜欢公共交通。 \nX城市的公交系统很奇怪。 与其他城市的系统不同,车票的费用是根据两个车站之间的距离计算的。 下图是描述距离和费用关系的表。\n\nlfgg是一个真正的穷苦人家。 他请您帮助他计算列出的两个地点之间的最低费用。 你能为他解决这个问题吗?\n为了简化此问题,可以假定所有车站都位于一条直线上。 我们使用x坐标来描述车站的位置。\n\u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/3ded0715437d1f93a616d55d648f779f?v\u003d1593605513\"\u003e \n \u003c/center\u003e \n "}},{"title":"Input","value":{"format":"MD","content":"注意,请使用_int64(我也不知为啥hdu不支持longlong了)\n\n输入包含几个测试用例。 首先,第一行输入是一个整数,表示测试样例个数,不超过20个用例。\n\n每个用例在第一行包含八个整数,分别是L1,L2,L3,L4,C1,C2,C3,C4,每个数字均为非负数且不大于1,000,000,000。 您还可以假定L1 \u003c\u003d L2 \u003c\u003d L3 \u003c\u003d L4。\n\n接下来给出n和m这两个整数,分别代表站点和问题的数量。 接下来的n行中的每行包含一个整数,表示第i个站的x坐标。 接下来的m行中的每行包含两个整数,分别代表起点和终点。\n\n你可以确定,不存在起点终点重合的情况\n\n对于每种情况2 \u003c\u003d N \u003c\u003d 100,0 \u003c\u003d M \u003c\u003d 500,每个x坐标在-1,000,000,000到1,000,000,000之间,并且没有两个x坐标具有相同的值。"}},{"title":"Output","value":{"format":"MD","content":"对于每个询问,如果起点终点可达,则打印两者之间的最低费用。 否则,打印“Station X and station Y are not attainable.” \n请参照样例输出"}},{"title":"Sample Input","value":{"format":"MD","content":"\u003cpre\u003e2\n1 2 3 4 1 3 5 7\n4 2\n1\n2\n3\n4\n1 4\n4 1\n1 2 3 4 1 3 5 7\n4 1\n1\n2\n3\n10\n1 4\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"MD","content":"\u003cpre\u003eCase 1:\nThe minimum cost between station 1 and station 4 is 3.\nThe minimum cost between station 4 and station 1 is 3.\nCase 2:\nStation 1 and station 4 are not attainable.\u003c/pre\u003e"}}]}