{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eYou are given a sequence of \u003cstrong\u003en\u003c/strong\u003e integers \u003cstrong\u003ea\u003csub\u003e1\u003c/sub\u003e , a\u003csub\u003e2\u003c/sub\u003e , ... , a\u003csub\u003en\u003c/sub\u003e\u003c/strong\u003e in non-decreasing order. In addition to that, you are given several queries consisting of indices \u003cstrong\u003ei\u003c/strong\u003e and \u003cstrong\u003ej\u003c/strong\u003e (\u003ci\u003e1 ≤ i ≤ j ≤ n\u003c/i\u003e). For each query, determine the most frequent value among the integers \u003cstrong\u003ea\u003csub\u003ei\u003c/sub\u003e , ... , a\u003csub\u003ej\u003c/sub\u003e\u003c/strong\u003e.\u003c/p\u003e\n \u003c/div\u003e\n给定一个非递减的序列,求某个区间内出现次数最多的数。"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eThe input consists of several test cases. Each test case starts with a line containing two integers \u003cstrong\u003en\u003c/strong\u003e and \u003cstrong\u003eq\u003c/strong\u003e (\u003ci\u003e1 ≤ n, q ≤ 100000\u003c/i\u003e). The next line contains \u003cstrong\u003en\u003c/strong\u003e integers \u003cstrong\u003ea\u003csub\u003e1\u003c/sub\u003e , ... , a\u003csub\u003en\u003c/sub\u003e\u003c/strong\u003e (\u003ci\u003e-100000 ≤ a\u003csub\u003ei\u003c/sub\u003e ≤ 100000\u003c/i\u003e, for each \u003ci\u003ei ∈ {1, ..., n}\u003c/i\u003e) separated by spaces. You can assume that for each \u003ci\u003ei ∈ {1, ..., n-1}: a\u003csub\u003ei\u003c/sub\u003e ≤ a\u003csub\u003ei+1\u003c/sub\u003e\u003c/i\u003e. The following \u003cstrong\u003eq\u003c/strong\u003e lines contain one query each, consisting of two integers \u003cstrong\u003ei\u003c/strong\u003e and \u003cstrong\u003ej\u003c/strong\u003e (\u003ci\u003e1 ≤ i ≤ j ≤ n\u003c/i\u003e), which indicate the boundary indices for the \u003cbr\u003equery.\u003c/p\u003e\n \u003cp\u003eThe last test case is followed by a line containing a single \u003ci\u003e0\u003c/i\u003e.\u003c/p\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003eFor each query, print one line with one integer: The number of occurrences of the most frequent value within the given range.\u003c/p\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e10 3\n-1 -1 1 1 1 1 3 10 10 10\n2 3\n1 10\n5 10\n0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e1\n4\n3\u003c/pre\u003e"}}]}