QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203605#5532. KangarooCamillus0 1ms7584kbC++201.7kb2023-10-06 18:35:502023-10-06 18:35:51

Judging History

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

  • [2023-10-06 18:35:51]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:7584kb
  • [2023-10-06 18:35:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

struct mint {
    static constexpr int mod = 1'000'000'007;
    int value = 0;

    mint() = default;
    mint(int value) : value(value) {}
};

mint operator+(const mint &A, const mint &B) {
    int value = A.value + B.value;
    if (value >= mint::mod) {
        value -= mint::mod;
    }
    return mint(value);
}

mint operator-(const mint &A, const mint &B) {
    int value = A.value + mint::mod - B.value;
    return mint(value);
}

mint operator*(const mint &A, const mint &B) {
    return mint(1ll * A.value * B.value % mint::mod);
}

mint A[300][300][300];
mint B[300][300][300];

signed main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#else
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    A[1][0][0] = 1;
    B[1][0][0] = 1;

    int n, s, f;
    cin >> n >> s >> f;
    s--, f--;

    for (int l = 2; l <= n; l++) {
        for (int i : {0}) {
            for (int j = 0; j < n; j++) {
                for (int k = i + 1; k < n; k++) {
                    A[l][i][j] = A[l][i][j] + B[l - 1][k - 1][j - (j > i)];
                }
                for (int k = 0; k < i; k++) {
                    B[l][i][j] = B[l][i][j] + A[l - 1][k][j - (j > i)];
                }
            }
        }
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < n; j++) {
                A[l][i][j] = B[l - 1][i - 1][j] - B[l - 1][i - 1][j - (j > i)];
                B[l][i][j] = A[l - 1][i - 1][j] + A[l - 1][i - 1][j - (j > i)];
            }
        }
    }

    cout << (A[n][s][f] + B[n][s][f]).value << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7584kb

input:

7 3 6

output:

1000000005

result:

wrong answer 1st numbers differ - expected: '14', found: '1000000005'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%