题面
题解
这数据范围……这输出大小……这模数……太有迷惑性了……
首先对于(0)来说,不管怎么选它们的排名都不会变,这个先特判掉
对于一个(a_i)来说,如果它不选,那么所有大于等于它的数随便选,乘(2)之后还是小于它的数也随便选
如果它选呢?所有大于等于它,且小于它的(2)倍的数全都得选,剩下的数就随便选不选了
然后没有然后了
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=a,I=b+1;i<I;++i)
#define fd(i,a,b) for(R int i=a,I=b-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
R int res,f=1;R char ch;
while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
return res*f;
}
char sr[1<<21],z[20];int K=-1,Z=0;
inline void Ot(){fwrite(sr,1,K+1,stdout),K=-1;}
void print(R int x){
if(K>1<<20)Ot();if(x<0)sr[++K]='-',x=-x;
while(z[++Z]=x%10+48,x/=10);
while(sr[++K]=z[Z],--Z);sr[++K]='
';
}
const int N=1e5+5,P=998244353;
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
R int res=1;
for(;y;y>>=1,x=mul(x,x))if(y&1)res=mul(res,x);
return res;
}
int ans[N],a[N],b[N],sum[N],fac[N],ifac[N];
int n,k,m,g;
inline int C(R int n,R int m){return (m>n||m<0)?0:1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
int main(){
// freopen("testdata.in","r",stdin);
n=read(),k=read();
fac[0]=ifac[0]=1;
fp(i,1,n)fac[i]=mul(fac[i-1],i);
ifac[n]=ksm(fac[n],P-2);fd(i,n-1,1)ifac[i]=mul(ifac[i+1],i+1);
fp(i,1,n)a[i]=b[i]=read();
sort(b+1,b+1+n),m=unique(b+1,b+1+n)-b-1;
fp(i,1,n)a[i]=lower_bound(b+1,b+1+m,a[i])-b,++sum[a[i]];
fp(i,1,m)sum[i]+=sum[i-1];
b[1]==0?ans[1]=C(n,k):0;
for(R int i=(b[1]==0)?2:1,j=0,l=0;i<=m;++i){
while(j<m&&(b[j+1]<<1)<b[i])++j;
while(l<m&&b[l+1]<(b[i]<<1))++l;
g=sum[l]-sum[i-1];
ans[i]=add(C(n-sum[i-1]-1+sum[j],k),C(n-g,k-g));
}
fp(i,1,n)print(ans[a[i]]);
return Ot(),0;
}