This is Code Apocalypse !!!

5

1 votes
Medium
Problem

This is CODE APOCALYPSE!! People are fighting against each other ,not for food ,money or life but for points. There are n people and each of them is fighting for some number of points.

Now you will be given q queries containing l and r. You have to tell the maximum number of people who are fighting for same number of point from l to r.

INPUT

First line contains a integer t denoting the number of test cases.

Every first line of each test case contains n and q where n are the number of people and q is the number of queries.

Every second line of test case contains n space separated integer ai denoting the point in non decreasing order.

Next q lines contains two integer l and r.

OUTPUT

For every q queries you have to print the maximum number of people fighting for same number of points in a new line.

CONSTRAINT

1<=n,q<=105

1<=ai<=106

1<=l<=r<=n

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?