QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#50174 | #4807. Melborp Lacissalc | sealnot123# | WA | 2ms | 7876kb | C++ | 1.5kb | 2022-09-25 02:14:52 | 2022-09-25 02:14:55 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'