题目描述
blablabla
样例
blablabla
题目简单
C++ 代码
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 100010;
int n,a[N];
bool check(int c, int b)
{
for(int k = b; k < c; k++)
if(a[k] == a[c])
return true;
return false;
}
int main()
{
cin >> n;
for(int i = 0; i< n; i++)
cin >> a[i];
int res = 0;
for(int i = 0,j = 0; i< n; i++)
{
while(j < i && check(i,j)) j++;
res = max(res,i-j+1);
//cout << res << " ";
}
cout << res;
return 0;
}