傻逼组合数学
考虑每个人翻不翻倍讨论即可
注意的情况
无聊写了个平衡树玩
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define pb push_back
cs int RLEN=1<<20|1;
inline char gc(){
static char ibuf[RLEN],*ib,*ob;
(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
return (ib==ob)?EOF:*ib++;
}
inline int read(){
char ch=gc();
int res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline char readchar(){
char ch=gc();
while(isspace(ch))ch=gc();
return ch;
}
template<class tp>inline void chemx(tp &a,tp b){a<b?a=b:0;}
template<class tp>inline void chemn(tp &a,tp b){a>b?a=b:0;}
cs int mod=998244353;
inline int add(int a,int b){return (a+=b)>=mod?(a-mod):a;}
inline void Add(int &a,int b){(a+=b)>=mod?(a-=mod):0;}
inline int dec(int a,int b){a-=b;return a+(a>>31&mod);}
inline void Dec(int &a,int b){a-=b,a+=a>>31&mod;}
inline int mul(int a,int b){static ll r;r=1ll*a*b;return (r>=mod)?(r%mod):r;}
inline void Mul(int &a,int b){static ll r;r=1ll*a*b,a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
cs int N=100005;
int n,k,a[N],fac[N],ifac[N];
inline void init_inv(){
cs int len=N-5;
fac[0]=ifac[0]=1;
for(int i=1;i<=len;i++)fac[i]=mul(fac[i-1],i);
ifac[len]=Inv(fac[len]);
for(int i=len-1;i;i--)ifac[i]=mul(ifac[i+1],i+1);
}
inline int C(int n,int m){return n<m?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}
namespace treap{
int rt,key[N],siz[N],val[N],tot,lc[N],rc[N];
inline int newnode(int k){
int u=++tot;key[u]=rand(),siz[u]=1,val[u]=k;
return u;
}
inline void pushup(int u){
siz[u]=siz[lc[u]]+siz[rc[u]]+1;
}
void split(int u,int &r1,int &r2,int k){
if(!u){r1=r2=0;return;}
if(k>=val[u]){
r1=u,split(rc[u],rc[r1],r2,k);
}
else r2=u,split(lc[u],r1,lc[r2],k);
pushup(u);
}
void merge(int &u,int r1,int r2){
if(!r1||!r2){u=r1+r2;return;}
if(key[r1]<key[r2]){
u=r1,merge(rc[u],rc[r1],r2);
}
else u=r2,merge(lc[u],r1,lc[r2]);
pushup(u);
}
void insert(int k){
int r1=0,r2=0;
split(rt,r1,r2,k);
merge(r1,r1,newnode(k));
merge(rt,r1,r2);
}
int getrk(int u,int k){
if(!u)return 0;
if(k<=val[u])return getrk(lc[u],k)+siz[rc[u]]+1;
else return getrk(rc[u],k);
}
int rk(int k){
return getrk(rt,k);
}
}
int main(){
#ifdef Stargazer
freopen("lx.in","r",stdin);
#endif
init_inv();
n=read(),k=read();
for(int i=1;i<=n;i++)a[i]=read(),treap::insert(a[i]);
for(int i=1;i<=n;i++){
int ret=0;
int rk1=treap::rk(a[i]),rk2=n-treap::rk((a[i]+1)/2);
Add(ret,C(rk1-1+rk2,k));
int rk3=treap::rk(a[i]*2),cd=rk1-rk3-(a[i]!=0);
if(k-1>=cd)Add(ret,C(n-cd-1,k-1-cd));
cout<<ret<<'
';
}
}