int N, a[100010]; char f[1000010]; int l = 0; { rd(N, a(N)); int ma = 0; REP(i, N){ f[a[i]]++; while (f[a[i]] > 1) f[a[l++]]--; ma = max(ma, i-l+1); } wt(ma); }