QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592172#6698. Flipping GameFoedere0WA 0ms3748kbC++201.3kb2024-09-26 21:02:302024-09-26 21:02:30

Judging History

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

  • [2024-09-26 21:02:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2024-09-26 21:02:30]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
typedef pair<int, int> PII;
int n, m, k;
string s1, s2;
int mod = 998244353;
int c[110][110];
int dp[110][110];
void into()
{
    for (int i = 0; i <= 110; i++)
    {
        c[i][0] = 1;
        for (int j = 1; j <= i; j++)
        {
            c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
        }
    }
}
void solve()
{
    memset(dp, 0, sizeof(dp));
    int cnt = 0;
    cin >> n >> k >> m;
    cin >> s1 >> s2;
    s1 = ' ' + s1;
    s2 = ' ' + s2;
    for (int i = 1; i <= n; i++)
    {
        if (s1[i] != s2[i])
        {
            cnt++;
        }
    }
    dp[0][cnt] = 1;
    for (int i = 0; i < k; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= m; k++)
            {
                if (j + 2 * k - m >= 0 && j + 2 * k - m <= n)
                {
                    dp[i + 1][j + 2 * k - m] += (dp[i][j] * (c[n - j][k] * c[j][m - k] % mod)) % mod;
                    dp[i + 1][j + 2 * k - m] %= mod;
                }
            }
        }
    }
    cout << dp[k][0] << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //into();
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3748kb

input:

3
3 2 1
001
100
3 1 2
001
100
3 3 2
001
100

output:

0
0
0

result:

wrong answer 1st numbers differ - expected: '2', found: '0'