\(Solution:\)
For each \ (K \) :
not considered repeated, apparently \ (C_ {n + 1}
^ k \) where we now to exclude repeated,WishSet \ (A_ {I +. 1} = A_ {J-. 1} \) ,
and repetitive occurs if and only if \ (a_ {i + 1} \) or \ (a_ {j-1} \) is selected
i.e. \ (I + J \) ( \ ([. 1, I] \) and \ ([J, n-] \) ) elements selected \ (k-1 \) a, so exclusion are \ (C_ {i + j} ^ {k-1} \) in
it the answer is \ (C_ {n + 1}
^ k-C_ {i + j} ^ {k-1} \) here we use Fermat little Theorem inversion yuan, and then enumerate each \ (k \) , can be a solution in linear time
\(Code:\)
#include<bits/stdc++.h>
using namespace std;
namespace my_std
{
typedef long long ll;
#define fr(i,x,y) for(ll i=(x);i<=(y);i++)
#define enter putchar('\n')
inline ll read()
{
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch))
{
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch))
{
sum=(sum<<1)+(sum<<3)+(ch^48);
ch=getchar();
}
return sum*f;
}
inline void write(ll x)
{
if(x<0)
{
putchar('-');
x=-x;
}
if(x>9) write(x/10);
putchar(x%10+'0');
}
}
using namespace my_std;
const ll N=1e5+50,mod=1e9+7;
ll n,ii,jj,vis[N],pos[N],mul[N],inv[N];
inline ll C(ll n,ll m)
{
if(m>n) return 0;
ll res=inv[m]*inv[n-m]%mod;
res=res*mul[n]%mod;
return res;
}
inline ll ksmod(ll a,ll b)
{
ll ans=1;
while(b)
{
if(b&1)
{
ans=(ans*a)%mod;
}
a=(a*a)%mod;
b>>=1;
}
return ans;
}
inline void cal_inv()
{
mul[0]=inv[0]=1;
for(ll i=1;i<=N;i++) mul[i]=mul[i-1]*i%mod;
inv[N]=ksmod(mul[N],mod-2);
for(ll i=N-1;i;i--) inv[i]=inv[i+1]*(i+1)%mod;
}
int main(void)
{
cal_inv();
n=read();
fr(i,1,n+1)
{
ll x=read();
if(vis[x])
{
jj=n+1-i;
ii=pos[x]-1;
break;
}
else
{
pos[x]=i;
vis[x]=1;
}
}
fr(i,1,n+1)
{
ll c1=C(n+1,i),c2=C(ii+jj,i-1),ans;
ans=c1-c2;
if(ans<0) ans+=mod;
write(ans);
enter;
}
return 0;
}