比赛 CSP2023-S模拟赛 评测结果 AAAAAAAAAAEEEEEEEEEE
题目名称 Maximized Combos 最终得分 50
用户昵称 usr10086 运行时间 3.775 s
代码语言 C++ 内存使用 13.95 MiB
提交时间 2023-10-17 21:43:42
显示代码纯文本
#include <bits/stdc++.h>

using namespace std;

ifstream fin("combos.in");
ofstream fout("combos.out");
#define cin fin
#define cout fout

#define int long long

const int MOD = 998244353;

int n, m;
int dp[2][101][101][101];

signed main()
{
    cin >> n >> m;
    int cur = 0, nxt = 1;
    dp[cur][1][1][1] = dp[cur][0][0][0] = 1;
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            for (int k = 0; k <= min(m, i); k++)
            {
                for (int l = 0; l <= i; l++)
                {
                    (dp[nxt][j+1][k+1][max(k+1,l)] += dp[cur][j][k][l]) %= MOD;
                    (dp[nxt][j][0][l] += dp[cur][j][k][l]) %= MOD;
                }
            }
        }
        for (int j = 0; j <= i; j++) for (int k = 0; k <= min(m, i); k++) for (int l = 0; l <= i; l++) dp[cur][j][k][l] = 0;
        swap(cur, nxt);
    }
    for (int s = 1; s <= m; s++) 
    {
        int res = 0;
        for (int c = 0; c <= m; c++) (res += dp[cur][m][c][s]) %= MOD;
        cout << res << '\n';
    }
}