There are $$N$$ (where $$N$$ is always even) players standing in a line where the coordinates of players are given as $$(X1,0), (X2,0)... (XN,0)$$. You are required to divide them into two teams such that there is an equal number of players on either side.
For this, you can select a coordinate $$(P, 0)$$ if and only if the number of players on the left-hand side is equal to the number of players on the right-hand side.
For the players on $$(P,0)$$, you are independent to choose their side.
Find the number of such possible coordinates where teams can be divided.
Note: Non-integral coordinates do not exist.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- For each test case:
- The first line contains an integer $$N$$ denoting the number of players.
- The second line contains an array of space-separated integers denoting array $$X$$.
Output format
Print a single line for each test case, denoting the number of coordinates $$(P, 0)$$ from where the teams can be divided.
Constraints
\(1 \leq T \leq 20000\)
\(1 \leq N \leq 200000\)
\(0 \leq |X_i| \leq 10^9\)
Here, $$N$$ is always even.
The sum of $$N$$ over all test cases does not exceed 200000.
First test case:
All the players are indicated by an line below the number, all the points which colored black above the number line is suitable for the team division, but we need to consider the only integer co-ordinates, so there are 4 {-2,-1,0,1}.
Note that while considering -2, we can decide which side we want to keep player at -2 and for division we will consider him on left.
Second test case:
Both the players are at 2, so the point we can choose is 2, we can decide to keep one player on left and one player on the right.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor