QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#50174#4807. Melborp Lacissalcsealnot123#WA 2ms7876kbC++1.5kb2022-09-25 02:14:522022-09-25 02:14:55

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-25 02:14:55]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:7876kb
  • [2022-09-25 02:14:52]
  • 提交

answer

#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back

#define rep(i,a,b) for(int i=a; i<(b); ++i)
#define FOR(i,a,b) for(int i=a; i<=(b); ++i)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int mod = 998244353;
const int N = 66;
int dp[N][N][N*N];
int fac[N], cnr[N][N];

int mul(int a, int b) {
    return a*1ll*b%mod;
}
int add(int a, int b) {
    return (a+=b)>=mod? a-mod:a;
}

void adding(int &a, int b) {
    a = add(a,b);
}

void solve() {
    fac[0] = 1;
    cnr[0][0] = 1;
    FOR(i, 1, N-1) {
        fac[i] = mul(fac[i-1],i);
        cnr[i][0] = 1;
        FOR(j, 1, i) {
            cnr[i][j] = add(cnr[i-1][j-1], cnr[i-1][j]);
            //printf("(%d,%d) = %d\n",i,j,cnr[i][j]);
        }
    }

    int n, k, t;
    scanf("%d %d %d",&n,&k,&t);
    // initialize
    FOR(j, 0, n) {
        dp[0][j][j*(j+1)/2] = cnr[n][j];
    }

    // dp
    FOR(i, 1, k-1) {
        FOR(j, 0, n) {
            FOR(l, 0, n) {
                if(j+l > n) break;
                FOR(m, 0, n*(n-1)/2) {
                    if(m+l*(l-1)/2 >= n*(n-1)/2) break;
                    adding(dp[i][j+l][m+l*(l-1)/2], mul(dp[i-1][j][m], cnr[n-j][l]));
                }
            }
        }
    }

    printf("%d",dp[k-1][n][t]);
}

int main() {
    solve();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 7876kb

input:

2 5 1

output:

0

result:

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