QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#242078#7644. Good SplitsSolitaryDreamCompile Error//C++171.7kb2023-11-06 22:20:082023-11-06 22:20:08

Judging History

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

  • [2023-11-06 22:20:08]
  • 评测
  • [2023-11-06 22:20:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int n, p;
int f[N * 2][N][N], pw2[N];
int h[N * 2][N * 2][N];
int F[N], G[N];
inline void A(int &x, int y) {
    x = (x + y >= p ? x + y - p : x + y);
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> p;
    f[0][0][0] = 1;
    for (int i = 0; i <= 2 * n; ++i)
        for (int j = 0; j <= i && j < N; ++j)
            for (int k = 0; j + k <= i && k < N; ++k) {
                int v = f[i][j][k];
                if (j) A(f[i + 1][j - 1][k], v);
                if (k) A(f[i + 1][j][k - 1], v);
                if (j + 1 < N) A(f[i + 1][j + 1][k], v);
                if (k + 1 < N) A(f[i + 1][j][k + 1], v);
            }
    for (int i = 0; i <= n; ++i) F[i] = f[i * 2][0][0];
    // for (int i = 0; i <= n; ++i) cout << F[i] << endl;
    h[0][0][0] = 1;
    for (int i = 1; i <= 2 * n; ++i)
        for (int j = 0; j <= i; ++j) 
            for (int k = 0; k * 2 <= j; ++k) {
                h[i][j][k] = h[i - 1][j][k];
                for (int t = i - 2; t >= 0; t -= 2) {
                    if (j - (i - t) >= 0 && k) h[i][j][k] = (h[i][j][k] + 1ll * F[(i - t) / 2 - 1] * h[t][j - (i - t)][k - 1]) % p; 
                }
            }
    G[0] = 1;
    pw2[0] = 1;
    for (int i = 1; i <= n; ++i) A(pw2[i], pw2[i - 1] * 2);
    for (int x = 1; x <= n; ++x) {
        G[x] = F[x];
        for (int i = 2; i <= 2 * x; i += 2) 
            for (int k = 1; k * 2 <= i; ++k) 
                G[x] = (G[x] - 1ll * G[x - i / 2] * h[2 * x][i][k] % p * (pw2[k] - 1)) % p;
        if (G[x] < 0) G[x] += p;
    }
    for (int i = 1; i <= n; ++i) cout << G[i] << '\n';
    return 0;
}23

Details

answer.code:48:2: error: expected unqualified-id before numeric constant
   48 | }23
      |  ^~