QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#760236#9740. Aho-Corasick 自动机SymmetreeWA 0ms3932kbC++171.1kb2024-11-18 15:47:272024-11-18 15:47:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-18 15:47:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3932kb
  • [2024-11-18 15:47:27]
  • 提交

answer

#include<bits/stdc++.h>
using i64 = long long;
using pii = std::pair<int,int>;
const int N = 105, mod = 998244353;
int n, m, d, f[N][N][N], g[N][N], c[N][N];
signed main() {
    scanf("%d%d%d", &n, &m, &d);
    for(int i = 0; i <= m; ++i) c[i][0] = c[i][i] = 1;
    for(int i = 1; i <= m; ++i)
        for(int j = 1; j <= m; ++j)
            c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
    g[0][0] = 1;
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j <= n; ++j)
            for(int k = 0; k <= std::min(m, j); ++k)
                g[i][j] = (g[i][j] + 1ll * g[i - 1][j - k] * c[m][k] % mod) % mod;
    f[0][1][1] = 1;
    for(int i = 1; i <= d; ++i)
        for(int j = 1; j <= n; ++j)
            for(int k = 1; k <= j; ++k)
                for(int t = 1; t <= j - k; ++t)
                    f[i][j][k] = (f[i][j][k] + 1ll * f[i - 1][j - k][t] * g[t][k] % mod) % mod;
    int ans = 0;
    for(int i = 1; i <= d; ++i)
        for(int j = 1; j <= n; ++j)
            ans += f[i][n][j], ans %= mod;
    printf("%d\n", ans);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3932kb

input:

3 2 2

output:

5

result:

ok answer is '5'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

4 2 2

output:

6

result:

ok answer is '6'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3828kb

input:

1 1 1

output:

0

result:

wrong answer expected '1', found '0'