{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFor the daily milking, Farmer John\u0027s \u003ci\u003eN\u003c/i\u003e cows (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simple, he will take a contiguous range of cows from the milking lineup to play the game. However, for all the cows to have fun they should not differ too much in height.\u003c/p\u003e\u003cp\u003eFarmer John has made a list of \u003ci\u003eQ\u003c/i\u003e (1 ≤ \u003ci\u003eQ\u003c/i\u003e ≤ 200,000) potential groups of cows and their heights (1 ≤ \u003ci\u003eheight\u003c/i\u003e ≤ 1,000,000). For each group, he wants your help to determine the difference in height between the shortest and the tallest cow in the group.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Two space-separated integers, \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eQ\u003c/i\u003e.\r\u003cbr\u003eLines 2..\u003ci\u003eN\u003c/i\u003e+1: Line \u003ci\u003ei\u003c/i\u003e+1 contains a single integer that is the height of cow \u003ci\u003ei\u003c/i\u003e\r\u003cbr\u003eLines \u003ci\u003eN\u003c/i\u003e+2..\u003ci\u003eN\u003c/i\u003e+\u003ci\u003eQ\u003c/i\u003e+1: Two integers \u003ci\u003eA\u003c/i\u003e and \u003ci\u003eB\u003c/i\u003e (1 ≤ \u003ci\u003eA\u003c/i\u003e ≤ \u003ci\u003eB\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e), representing the range of cows from \u003ci\u003eA\u003c/i\u003e to \u003ci\u003eB\u003c/i\u003e inclusive."}},{"title":"Output","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":"Sample","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\r\n1\r\n7\r\n3\r\n4\r\n2\r\n5\r\n1 5\r\n4 6\r\n2 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n3\r\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}