799 最长连续不重复子序列
#include <iostream>
using namespace std;
const int N = 100010;
int n;
int a[N],s[N];
int res=0;
//s[x]表示当前j-i的字符串中,的字母出现次数,只有全为1才是不重复
int main(){
cin >> n;
for( int i = 0; i < n; i ++ ) cin >> a[i];
for(int i = 0, j = 0; i < n; i ++ ){
s[a[i]]++;
while(s[a[i]] > 1){
s[a[j]]--;
j++;
}
res = max(res, i - j + 1);
}
cout << res << endl;
return 0;
}
// 12313