#K75747. Minimum Contest Days

    ID: 34488 Type: Default 1000ms 256MiB

Minimum Contest Days

Minimum Contest Days

You are organizing a series of contest sessions, each with a given difficulty score. Your task is to determine the minimum number of days required to schedule all sessions so that no day contains two sessions with difficulty scores that differ by exactly (1).

In other words, if there exists any pair of contest sessions whose scores differ by (1) when the scores are sorted, then it is necessary to use at least two different days. Otherwise, all sessions can be scheduled on a single day.

Key Observation: After sorting the list of difficulty scores, if there is any consecutive pair (b[i]) and (b[i-1]) for which (b[i] - b[i-1] = 1), then the answer is (2). If no such pair exists, the answer is (1).

Input is read from standard input, and output is printed to standard output.

inputFormat

The first line of input contains a single integer (t) ((1 \leq t \leq 100)), representing the number of test cases. Each test case consists of two lines:

  1. The first line contains a single integer (m) ((1 \leq m \leq 100)), the number of contest sessions.
  2. The second line contains (m) space-separated integers (b_1, b_2, \ldots, b_m) (each (1 \leq b_i \leq 100)), representing the difficulty scores of the contest sessions.

outputFormat

For each test case, output a single integer on a new line representing the minimum number of days required to arrange the contest sessions so that no two sessions scheduled on the same day have difficulty scores differing by exactly (1).## sample

3
3
1 2 3
2
4 7
4
10 11 12 15
2

1 2

</p>