{"trustable":false,"sections":[{"title":"题目描述","value":{"format":"HTML","content":"对于每日挤奶,Farmer John\u0027s N 奶牛(1 ≤ N ≤ 50,000 奶牛)始终按相同的顺序排列。有一天,农夫约翰决定和一些奶牛一起组织一场终极飞盘游戏。为了简单起见,他将从挤奶阵容中选取连续的奶牛来玩游戏。但是,为了让所有的奶牛都玩得开心,它们的高度不应该相差太大。\n\n农民约翰列出了Q(1≤Q≤200,000)潜在奶牛群及其身高(1≤身高≤1,000,000)。对于每个群体,他希望你帮助确定群体中最矮和最高的奶牛之间的身高差异。"}},{"title":"输入","value":{"format":"HTML","content":"Line 1: Two space-separated integers, N and Q.\nLines 2..N+1: Line i+1 contains a single integer that is the height of cow i\nLines N+2..N+Q+1: Two integers A and B (1 ≤ A ≤ B ≤ N), representing the range of cows from A to B inclusive."}},{"title":"输出","value":{"format":"HTML","content":"Lines 1..\u003ci\u003eQ\u003c/i\u003e: Each line contains a single integer that is a response to a reply and indicates the difference in height between the tallest and shortest cow in the range."}},{"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\u003e6 3\n1\n7\n3\n4\n2\n5\n1 5\n4 6\n2 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n3\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}