You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
586 B
C++
26 lines
586 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 10050;
|
|
int a[N];
|
|
int main()
|
|
{
|
|
int T, n;
|
|
cin >> T;
|
|
while (T--)
|
|
{
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++)
|
|
scanf("%d", a + i);
|
|
int cur = 1, ans = 1;
|
|
for (int i = 1; i < n; i++)
|
|
if (a[i] == a[i - 1] + 1)
|
|
cur++;
|
|
else
|
|
ans = max(ans, cur), cur = 1;
|
|
cout << max(ans, cur) << endl;
|
|
}
|
|
return 0;
|
|
}
|