比赛 |
CSP2023-S模拟赛 |
评测结果 |
AAATTTATTTTTTTTTTTTT |
题目名称 |
Maximized Combos |
最终得分 |
20 |
用户昵称 |
┭┮﹏┭┮ |
运行时间 |
16.154 s |
代码语言 |
C++ |
内存使用 |
10.89 MiB |
提交时间 |
2023-10-17 21:40:40 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+10,mod = 998244353;
int n,m;
int a[N];
ll ans[N];
int check(){
int ans = 0,s = 0;
for(int i = 1;i <= n;i++){
if(a[i] == 1)ans++;
else s = max(s,ans),ans = 0;
}
s = max(ans,s);
return s;
}
void sou(int i,int s){
if(s == m+1){
int u = check();
ans[u] = (ans[u] + 1) % mod;
return;
}
if(i > n)return;
a[i] = 1;
sou(i+1,s+1);
a[i] = 0;
sou(i+1,s);
}
int main(){
freopen("combos.in","r",stdin);
freopen("combos.out","w",stdout);
scanf("%d%d",&n,&m);
sou(1,1);
for(int i = 1;i <= m;i++)
printf("%lld\n",ans[i]);
return 0;
}